mirror of
https://github.com/QuotifyTeam/QuotifyBE.git
synced 2025-12-16 14:20:06 +01:00
feat: enable request logging for development environment
This commit is contained in:
20
Program.cs
20
Program.cs
@@ -46,6 +46,7 @@ builder.Services.AddSingleton(builder.Configuration);
|
||||
builder.Services.AddScoped<GeneralUseHelpers>();
|
||||
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddHttpLogging(o => { });
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen(options =>
|
||||
@@ -72,26 +73,27 @@ builder.Services.AddSwaggerGen(options =>
|
||||
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, xmlFilename));
|
||||
});
|
||||
|
||||
var app = builder.Build();
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
||||
var guhf = scope.ServiceProvider.GetRequiredService<GeneralUseHelpers>();
|
||||
|
||||
var seeder = new Seed(db, guhf);
|
||||
await seeder.SeedAsync();
|
||||
var app = builder.Build();
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
||||
var guhf = scope.ServiceProvider.GetRequiredService<GeneralUseHelpers>();
|
||||
|
||||
var seeder = new Seed(db, guhf);
|
||||
await seeder.SeedAsync();
|
||||
}
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseHttpLogging();
|
||||
app.UseMigrationsEndPoint();
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user