Files
SIG-CM/src/SIGCM.API/Program.cs

36 lines
734 B
C#
Raw Normal View History

using SIGCM.Infrastructure;
using SIGCM.Infrastructure.Data;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddInfrastructure();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
// Initialize DB
using (var scope = app.Services.CreateScope())
{
var initializer = scope.ServiceProvider.GetRequiredService<DbInitializer>();
await initializer.InitializeAsync();
}
app.Run();