Skip to content

Commit aa87e04

Browse files
authored
Add Swashbuckle/Swagger (#1)
1 parent 8504df9 commit aa87e04

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ASP.NET Core Basics/src/Contacts/Startup.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public void ConfigureServices(IServiceCollection services)
5555

5656
services.AddDbContext<ContactsContext>(options =>
5757
options.UseSqlServer(Configuration["Data:ContactsContext:ConnectionString"]));
58+
59+
services.AddSwaggerGen();
5860
}
5961

6062
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@@ -94,6 +96,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
9496
name: "default",
9597
template: "{controller=Home}/{action=Index}/{id?}");
9698
});
99+
100+
app.UseSwagger();
101+
app.UseSwaggerUi();
97102
}
98103
}
99104
}

ASP.NET Core Basics/src/Contacts/project.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"userSecretsId": "aspnet-Contacts-cd2c7b27-e79c-43c7-b3ef-1ecb04374b70",
33

44
"dependencies": {
@@ -43,7 +43,8 @@
4343
"version": "1.1.0-preview4-final",
4444
"type": "build"
4545
},
46-
"BundlerMinifier.Core": "2.2.301"
46+
"BundlerMinifier.Core": "2.2.301",
47+
"Swashbuckle": "6.0.0-beta902"
4748
},
4849

4950
"tools": {

0 commit comments

Comments
 (0)