mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
fix(directory): 🐛 fix swagger server path to include 'api' prefix
This commit is contained in:
parent
13db19857e
commit
36e3eb9739
1 changed files with 9 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
|
|
@ -32,7 +33,14 @@ public static void AddSwaggerGen(this IServiceCollection services)
|
|||
|
||||
public static void UseSwagger(this IApplicationBuilder app)
|
||||
{
|
||||
app.UseSwagger(o => o.RouteTemplate = "{documentName}/swagger.json");
|
||||
app.UseSwagger(o =>
|
||||
{
|
||||
o.RouteTemplate = "{documentName}/swagger.json";
|
||||
o.PreSerializeFilters.Add((swaggerDoc, httpReq) => swaggerDoc.Servers = new List<OpenApiServer>
|
||||
{
|
||||
new OpenApiServer {Url = $"{httpReq.Scheme}://{httpReq.Host.Value}/api"}
|
||||
});
|
||||
});
|
||||
app.UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("v1/swagger.json", "FilterLists Directory API V1");
|
||||
|
|
|
|||
Loading…
Reference in a new issue