-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartup.cs
42 lines (35 loc) · 1.18 KB
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using ProductCatalog.Data;
using ProductCatalog.Repositories;
using Swashbuckle.AspNetCore.Swagger;
namespace ProductCatalog
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddResponseCompression();
services.AddScoped<StoreDataContext, StoreDataContext>();
services.AddTransient<ProductRepository, ProductRepository>();
services.AddSwaggerGen(x => {
x.SwaggerDoc("v1", new Info { Title = "Product API", Version = "v1"});
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
app.UseDeveloperExceptionPage();
app.UseMvc();
app.UseResponseCompression();
app.UseSwagger();
app.UseSwaggerUI(x => {
x.SwaggerEndpoint("/swagger/v1/swagger.json", "Product API - v1");
});
}
}
}