-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
45 lines (37 loc) · 1.21 KB
/
Copy pathProgram.cs
File metadata and controls
45 lines (37 loc) · 1.21 KB
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
43
44
45
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new OpenApiInfo
{
Version = "v1",
Title = "PatrimWeb API",
Description = "Projeto de estudo: Criação de Web API usando ASP.Net Core 8 + Swagger + Arquitetura REST.",
TermsOfService = new Uri("https://github.com/sarsdev/webapi_aspnet8_patrimweb/blob/main/README.md"),
Contact = new OpenApiContact
{
Name = "Sars Dev",
Url = new Uri("https://github.com/sarsdev")
},
License = new OpenApiLicense
{
Name = "GNU GENERAL PUBLIC LICENSE",
Url = new Uri("https://github.com/sarsdev/webapi_aspnet8_patrimweb/blob/main/LICENSE")
}
});
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "v1");
options.RoutePrefix = string.Empty;
});
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();