Skip to content

Commit 4666285

Browse files
committed
configured swagger
1 parent aede55e commit 4666285

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

OA/OA.Infrastructure/Extension/ConfigureContainer.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ public static void ConfigureCustomExceptionMiddleware(this IApplicationBuilder a
1010
app.UseMiddleware<CustomExceptionMiddleware>();
1111
}
1212

13+
1314
public static void ConfigureSwagger(this IApplicationBuilder app)
1415
{
1516
app.UseSwagger();
1617

1718
app.UseSwaggerUI(setupAction =>
1819
{
1920
setupAction.SwaggerEndpoint("/swagger/OpenAPISpecification/swagger.json", "Onion Architecture API");
20-
setupAction.RoutePrefix = string.Empty;
21+
setupAction.RoutePrefix = "OpenAPI";
2122
});
2223
}
2324

OA/OA.Infrastructure/OA.Infrastructure.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
<TargetFramework>netcoreapp3.1</TargetFramework>
55
</PropertyGroup>
66

7+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
8+
<DocumentationFile>OA.Infrastructure.xml</DocumentationFile>
9+
<NoWarn>1701;1702;1591</NoWarn>
10+
</PropertyGroup>
11+
712
<ItemGroup>
813
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
914
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.5">

OA/OA.Infrastructure/OA.Infrastructure.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OA/OA/Properties/launchSettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212
"IIS Express": {
1313
"commandName": "IISExpress",
1414
"launchBrowser": true,
15-
"launchUrl": "weatherforecast",
15+
"launchUrl": "OpenAPI/index.html",
1616
"environmentVariables": {
1717
"ASPNETCORE_ENVIRONMENT": "Development"
1818
}
1919
},
2020
"OA": {
2121
"commandName": "Project",
2222
"launchBrowser": true,
23-
"launchUrl": "weatherforecast",
23+
"launchUrl": "OpenAPI/index.html",
2424
"applicationUrl": "https://localhost:5001;http://localhost:5000",
2525
"environmentVariables": {
2626
"ASPNETCORE_ENVIRONMENT": "Development"

OA/OA/Startup.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
4848

4949
app.UseAuthorization();
5050

51+
app.ConfigureCustomExceptionMiddleware();
52+
53+
app.ConfigureSwagger();
54+
5155
app.UseEndpoints(endpoints =>
5256
{
5357
endpoints.MapControllers();

0 commit comments

Comments
 (0)