mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
initial add swagger/swashbuckle
This commit is contained in:
parent
ac26c41033
commit
2bb11771f2
2 changed files with 27 additions and 1 deletions
|
|
@ -10,6 +10,7 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.1.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
|
||||
namespace FilterLists.Api
|
||||
{
|
||||
|
|
@ -22,6 +23,23 @@ public void ConfigureServices(IServiceCollection services)
|
|||
services.AddFilterListsRepositories(Configuration);
|
||||
services.AddFilterListsServices();
|
||||
services.AddFilterListsApi();
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
c.SwaggerDoc("v1",
|
||||
new Info
|
||||
{
|
||||
Title = "FilterLists API",
|
||||
Version = "v1",
|
||||
Description =
|
||||
"FilterLists is the independent and comprehensive directory of all public filter and hosts lists for advertisements, trackers, malware, and annoyances.",
|
||||
Contact = new Contact {Url = "https://filterlists.com/contact/"},
|
||||
License = new License
|
||||
{
|
||||
Name = "Use under GPL-3.0",
|
||||
Url = "https://github.com/collinbarrett/FilterLists/blob/master/LICENSE"
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
|
|
@ -29,7 +47,14 @@ public void Configure(IApplicationBuilder app)
|
|||
app.UseForwardedHeaders(new ForwardedHeadersOptions
|
||||
{
|
||||
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
|
||||
}).UseMvc();
|
||||
});
|
||||
|
||||
app.UseSwagger().UseSwaggerUI(c =>
|
||||
{
|
||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "FilterLists API V1");
|
||||
});
|
||||
|
||||
app.UseMvc();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue