-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
25 lines (19 loc) · 900 Bytes
/
Program.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
using CardApi.Benchmarks;
using CardApi.DbConnections;
using CardApi.Services;
var builder = WebApplication.CreateBuilder(args);
var connectionString = builder.Configuration.GetConnectionString("localDB");
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddOpenApi();
builder.Services.AddSingleton(new SqliteDbConnectionFactory(connectionString));
builder.Services.AddTransient<ICardRepository, CardRepository>();
builder.Services.AddTransient<IDbOperationRepository, DbOperationsRepository>();
builder.Services.AddTransient<IProjectRepository, ProjectRepository>();
builder.Services.AddTransient<IBenchmarkRepository, BenchmarkRepository>();
var app = builder.Build();
app.MapOpenApi();
app.UseSwaggerUI(options => { options.SwaggerEndpoint("/openapi/v1.json", "API benchmark v1"); });
app.UseHttpsRedirection();
app.MapControllers();
app.Run();