MAJ Program en FastEndpoint

This commit is contained in:
2025-10-08 16:27:55 +02:00
parent c729af3d32
commit bd8495b79a

View File

@@ -1,18 +1,19 @@
var builder = WebApplication.CreateBuilder(args); using API;
using FastEndpoints;
using FastEndpoints.Swagger;
using PyroFetes;
// Add services to the container. WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build(); // On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet
builder.Services.AddFastEndpoints().SwaggerDocument();
// Configure the HTTP request pipeline. // On ajoute ici la configuration de la base de données
if (app.Environment.IsDevelopment()) builder.Services.AddDbContext<PyroFetesDbContext>();
{
app.UseSwagger(); // On construit l'application en lui donnant vie
app.UseSwaggerUI(); WebApplication app = builder.Build();
} app.UseFastEndpoints().UseSwaggerGen();
app.UseHttpsRedirection(); app.UseHttpsRedirection();