-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartup.cs
52 lines (45 loc) · 1.5 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
43
44
45
46
47
48
49
50
51
52
using ControleTarefas.Repository.Interface.IRepositories;
using ControleTarefas.Repository.Repositories;
using ControleTarefas.Service.Interface.Services;
using ControleTarefas.Service.Services;
using Microsoft.OpenApi.Any;
using Microsoft.OpenApi.Models;
namespace ControleTarefas.WebApi
{
public class Startup
{
public Startup()
{
}
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddScoped<ITarefaRepository, TarefaRepository>();
services.AddScoped<ITarefaService, TarefaService>();
services.AddSwaggerGen(c =>
{
c.MapType(typeof(TimeSpan), () => new() { Type = "string", Example = new OpenApiString("00:00:00") });
c.SwaggerDoc("v1", new OpenApiInfo
{
Title = "Controle de Tarefas",
Version = "v1",
Description = "APIs de estudo"
});
});
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Controle de Tarefas v1");
c.RoutePrefix = string.Empty;
});
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}