From b075338fe8dc773658bc5dcb55ea5112d39fd5fe Mon Sep 17 00:00:00 2001 From: Shayne Boyer Date: Wed, 16 Apr 2025 15:50:22 -0400 Subject: [PATCH] Refactor Swagger UI and static file serving order --- src/api/Program.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/api/Program.cs b/src/api/Program.cs index e51fecba..f99e09c6 100644 --- a/src/api/Program.cs +++ b/src/api/Program.cs @@ -32,19 +32,19 @@ policy.AllowAnyMethod(); }); -// Swagger UI -app.UseSwaggerUI(options => -{ - options.SwaggerEndpoint("./openapi.yaml", "v1"); - options.RoutePrefix = ""; -}); - +// This must come BEFORE UseSwaggerUI app.UseStaticFiles(new StaticFileOptions { // Serve openapi.yaml file ServeUnknownFileTypes = true, }); +// Swagger UI +app.UseSwaggerUI(options => +{ + options.SwaggerEndpoint("./openapi.yaml", "v1"); + options.RoutePrefix = ""; +}); app.MapGroup("/lists") .MapTodoApi()