From d3c7de189b3efca192eebe67494b11963723d1ce Mon Sep 17 00:00:00 2001 From: Xander Sigler Date: Wed, 26 Jan 2022 23:20:32 -0800 Subject: [PATCH] Rewrite index to swagger page --- AOC2021/Startup.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AOC2021/Startup.cs b/AOC2021/Startup.cs index 3fbc8d8..ec6d512 100644 --- a/AOC2021/Startup.cs +++ b/AOC2021/Startup.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; +using Microsoft.AspNetCore.Rewrite; namespace AOC2021 { @@ -49,6 +50,9 @@ namespace AOC2021 app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AOC2021 v1")); + var option = new RewriteOptions(); + option.AddRedirect("^$", "swagger"); + app.UseRewriter(option); //Default to swagger app.UseRouting(); @@ -58,6 +62,7 @@ namespace AOC2021 { endpoints.MapControllers(); }); + }