Rewrite index to swagger page
continuous-integration/drone/push Build is passing Details

master
Xander Sigler 3 years ago
parent 5fea499da4
commit d3c7de189b

@ -5,6 +5,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using Microsoft.AspNetCore.Rewrite;
namespace AOC2021 namespace AOC2021
{ {
@ -49,6 +50,9 @@ namespace AOC2021
app.UseSwagger(); app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "AOC2021 v1")); 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(); app.UseRouting();
@ -58,6 +62,7 @@ namespace AOC2021
{ {
endpoints.MapControllers(); endpoints.MapControllers();
}); });
} }

Loading…
Cancel
Save