diff --git a/gateways/KonSoft.InternalGateway/Program.cs b/gateways/KonSoft.InternalGateway/Program.cs index 3701eee..b6677f5 100644 --- a/gateways/KonSoft.InternalGateway/Program.cs +++ b/gateways/KonSoft.InternalGateway/Program.cs @@ -2,6 +2,7 @@ using KonSoft.InternalGateway; using KonSoft.InternalGateway.Extensions; using KonSoft.Shared.Hosting.AspNetCore; using Microsoft.AspNetCore.Rewrite; +using Microsoft.OpenApi.Models; using Serilog; var assemblyName = typeof(Program).Assembly.GetName().Name!; @@ -19,16 +20,28 @@ try .AddAppSettingsSecretsJson() .UseAutofac() .UseSerilog(); + + builder.Services.AddSwaggerGen(options => + { + options.SwaggerDoc("v1", new OpenApiInfo + { + Title = "Gateway", + Version = "v1" + }); + options.DocInclusionPredicate((docName, description) => true); + options.CustomSchemaIds(type => type.FullName); + }); + + builder.Services.AddReverseProxy() .LoadFromConfig(builder.Configuration.GetSection("ReverseProxy")); builder.Services.AddControllers(); await builder.AddApplicationAsync(); var app = builder.Build(); await app.InitializeApplicationAsync(); + app.UseSwaggerUIWithYarp(); app.MapReverseProxy(); app.MapGet("/heath", () => "Online"); - app.UseSwaggerUIWithYarp(); - app.UseRewriter(new RewriteOptions().AddRedirect("^(|\\|\\s+)$", "/swagger")); await app.RunAsync(); return 0;