mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
move addswagger service to ext. method
This commit is contained in:
parent
791fa56e06
commit
206722ebe7
2 changed files with 29 additions and 24 deletions
|
|
@ -1,4 +1,7 @@
|
|||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
|
||||
namespace FilterLists.Api.DependencyInjection.Extensions
|
||||
{
|
||||
|
|
@ -7,6 +10,30 @@ public static class ConfigureServicesCollection
|
|||
public static void AddFilterListsApi(this IServiceCollection services)
|
||||
{
|
||||
services.AddMvc();
|
||||
services.AddSwagger();
|
||||
}
|
||||
|
||||
private static void AddSwagger(this IServiceCollection services)
|
||||
{
|
||||
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"
|
||||
}
|
||||
});
|
||||
c.IncludeXmlComments(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath,
|
||||
"FilterLists.Api.xml"));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +1,9 @@
|
|||
using System.IO;
|
||||
using FilterLists.Api.DependencyInjection.Extensions;
|
||||
using FilterLists.Api.DependencyInjection.Extensions;
|
||||
using FilterLists.Services.DependencyInjection.Extensions;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.PlatformAbstractions;
|
||||
using Swashbuckle.AspNetCore.Swagger;
|
||||
|
||||
namespace FilterLists.Api
|
||||
{
|
||||
|
|
@ -23,25 +20,6 @@ public void ConfigureServices(IServiceCollection services)
|
|||
{
|
||||
services.AddFilterListsServices(Configuration);
|
||||
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"
|
||||
}
|
||||
});
|
||||
c.IncludeXmlComments(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath,
|
||||
"FilterLists.Api.xml"));
|
||||
});
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
|
|
|
|||
Loading…
Reference in a new issue