From bd8495b79a513c3c2175df247cd63bdd3adf318f Mon Sep 17 00:00:00 2001 From: colesm Date: Wed, 8 Oct 2025 16:27:55 +0200 Subject: [PATCH] MAJ Program en FastEndpoint --- PyroFetes/Program.cs | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/PyroFetes/Program.cs b/PyroFetes/Program.cs index d127d73..e610bf4 100644 --- a/PyroFetes/Program.cs +++ b/PyroFetes/Program.cs @@ -1,18 +1,19 @@ -var builder = WebApplication.CreateBuilder(args); +using API; +using FastEndpoints; +using FastEndpoints.Swagger; +using PyroFetes; -// Add services to the container. -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); +WebApplicationBuilder builder = WebApplication.CreateBuilder(args); -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. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} +// On ajoute ici la configuration de la base de données +builder.Services.AddDbContext(); + +// On construit l'application en lui donnant vie +WebApplication app = builder.Build(); +app.UseFastEndpoints().UseSwaggerGen(); app.UseHttpsRedirection();