0
0

Add basic swagger support

This commit is contained in:
Serghei Cebotari 2024-01-14 16:03:42 +03:00
parent a311cf9f3e
commit 0452f379c6
2 changed files with 9 additions and 1 deletions

View File

@ -60,10 +60,17 @@ builder.Services.AddKeyedTransient<IProductQueryModifier, Sleeve>("Монтаж
.AddKeyedTransient<IProductQueryModifier, StabilPipe>("Stabil") .AddKeyedTransient<IProductQueryModifier, StabilPipe>("Stabil")
.AddKeyedTransient<IProductQueryModifier, BlackPipe>("Black"); .AddKeyedTransient<IProductQueryModifier, BlackPipe>("Black");
builder.Services.AddSwaggerGen();
var app = builder.Build(); var app = builder.Build();
app.MapControllers(); app.MapControllers();
app.UseMiddleware<QueryModifier>(); app.UseMiddleware<QueryModifier>();
app.UseSwagger().UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
options.RoutePrefix = string.Empty;
});
var context = app.Services.CreateScope().ServiceProvider var context = app.Services.CreateScope().ServiceProvider
.GetRequiredService<RhSolutionsContext>(); .GetRequiredService<RhSolutionsContext>();

View File

@ -19,6 +19,7 @@
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
<PackageReference Include="Rhsolutions.ProductSku" Version="1.0.2" /> <PackageReference Include="Rhsolutions.ProductSku" Version="1.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>