Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static IServiceCollection AddRequiredMvcComponents(this IServiceCollectio
services.AddTransient<ApiExceptionFilter>();

var mvcBuilder = services.AddMvcCore(options => { options.Filters.Add<ApiExceptionFilter>(); });
mvcBuilder.AddApiExplorer(); //for swagger
mvcBuilder.SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
mvcBuilder.AddJsonFormatters();
return services;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
</PackageReference>
<PackageReference Include="Serilog.Sinks.File" Version="2.2.0">
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"O2NextGen.CertificateManagement.Web": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using O2NextGen.CertificateManagement.Api.Setup;
using O2NextGen.CertificateManagement.Api.Helpers;
using O2NextGen.CertificateManagement.Api.IoC;
using Swashbuckle.AspNetCore.Swagger;

[assembly: ApiController]
namespace O2NextGen.CertificateManagement.Api
Expand All @@ -28,6 +29,17 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddRequiredMvcComponents();
services.AddBusiness();
services.AddSwaggerGen(options =>
{
options.DescribeAllEnumsAsStrings();
options.SwaggerDoc("v1",new Info()
{
Title = "O2NextGen Platform. C-Gen HTTP API",
Version = "v1",
Description = "C-Gen API Service. The service allows you to create certificates",
TermsOfService = "Terms of Service"
});
});
services.AddConfigEf(AppConfiguration);
services.ConfigurePOCO<UrlsConfig>(AppConfiguration.GetSection("Urls"));
}
Expand Down Expand Up @@ -58,7 +70,11 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
}

app.UseStaticFiles();

app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint($"/swagger/v1/swagger.json", "C-Gen API V1");
});
app.Use(async (context, next) =>
{
context.Response.OnStarting(() =>
Expand Down