|
1 | 1 | using Microsoft.OpenApi.Models; |
2 | 2 | using ServiceBusMessaging; |
3 | 3 |
|
4 | | -namespace AspNetCoreServiceBusApi1 |
| 4 | +namespace AspNetCoreServiceBusApi1; |
| 5 | + |
| 6 | +public class Startup |
5 | 7 | { |
6 | | - public class Startup |
| 8 | + public Startup(IConfiguration configuration) |
7 | 9 | { |
8 | | - public Startup(IConfiguration configuration) |
9 | | - { |
10 | | - Configuration = configuration; |
11 | | - } |
| 10 | + Configuration = configuration; |
| 11 | + } |
12 | 12 |
|
13 | | - public IConfiguration Configuration { get; } |
| 13 | + public IConfiguration Configuration { get; } |
14 | 14 |
|
15 | | - public void ConfigureServices(IServiceCollection services) |
16 | | - { |
17 | | - services.AddControllers(); |
| 15 | + public void ConfigureServices(IServiceCollection services) |
| 16 | + { |
| 17 | + services.AddControllers(); |
18 | 18 |
|
19 | | - services.AddScoped<ServiceBusSender>(); |
20 | | - services.AddScoped<ServiceBusTopicSender>(); |
| 19 | + services.AddScoped<ServiceBusSender>(); |
| 20 | + services.AddScoped<ServiceBusTopicSender>(); |
21 | 21 |
|
22 | | - services.AddSwaggerGen(c => |
| 22 | + services.AddSwaggerGen(c => |
| 23 | + { |
| 24 | + c.SwaggerDoc("v1", new OpenApiInfo |
23 | 25 | { |
24 | | - c.SwaggerDoc("v1", new OpenApiInfo |
25 | | - { |
26 | | - Version = "v1", |
27 | | - Title = "Payload View API", |
28 | | - }); |
| 26 | + Version = "v1", |
| 27 | + Title = "Payload View API", |
29 | 28 | }); |
30 | | - } |
| 29 | + }); |
| 30 | + } |
31 | 31 |
|
32 | | - public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| 32 | + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) |
| 33 | + { |
| 34 | + if (env.IsDevelopment()) |
33 | 35 | { |
34 | | - if (env.IsDevelopment()) |
35 | | - { |
36 | | - app.UseDeveloperExceptionPage(); |
37 | | - } |
38 | | - else |
39 | | - { |
40 | | - app.UseHsts(); |
41 | | - } |
| 36 | + app.UseDeveloperExceptionPage(); |
| 37 | + } |
| 38 | + else |
| 39 | + { |
| 40 | + app.UseHsts(); |
| 41 | + } |
42 | 42 |
|
43 | | - app.UseStaticFiles(); |
44 | | - app.UseHttpsRedirection(); |
| 43 | + app.UseStaticFiles(); |
| 44 | + app.UseHttpsRedirection(); |
45 | 45 |
|
46 | | - app.UseRouting(); |
| 46 | + app.UseRouting(); |
47 | 47 |
|
48 | | - app.UseAuthorization(); |
49 | | - app.UseCors(); |
| 48 | + app.UseAuthorization(); |
| 49 | + app.UseCors(); |
50 | 50 |
|
51 | | - app.UseEndpoints(endpoints => |
52 | | - { |
53 | | - endpoints.MapControllers(); |
54 | | - }); |
| 51 | + app.UseEndpoints(endpoints => |
| 52 | + { |
| 53 | + endpoints.MapControllers(); |
| 54 | + }); |
55 | 55 |
|
56 | | - app.UseSwagger(); |
57 | | - app.UseSwaggerUI(c => |
58 | | - { |
59 | | - c.SwaggerEndpoint("/swagger/v1/swagger.json", "Payload Management API V1"); |
60 | | - }); |
61 | | - } |
| 56 | + app.UseSwagger(); |
| 57 | + app.UseSwaggerUI(c => |
| 58 | + { |
| 59 | + c.SwaggerEndpoint("/swagger/v1/swagger.json", "Payload Management API V1"); |
| 60 | + }); |
62 | 61 | } |
63 | 62 | } |
0 commit comments