|
|
|
@ -16,6 +16,9 @@ var config = builder.Configuration;
|
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
|
|
|
|
|
|
builder.Services.AddHttpLogging(o => {});
|
|
|
|
|
|
|
|
|
|
builder.Services.AddControllers()
|
|
|
|
|
.ConfigureApiBehaviorOptions(options => options.InvalidModelStateResponseFactory = context =>
|
|
|
|
|
new BadRequestObjectResult(context.ModelState)
|
|
|
|
@ -53,16 +56,17 @@ builder.Services.AddScoped<IUserService, DbUserService>();
|
|
|
|
|
builder.Services.AddScoped<ITeamService, DbTeamService>();
|
|
|
|
|
builder.Services.AddScoped<ITacticService, DbTacticService>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
System.AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
|
|
|
|
|
|
|
|
|
app.Use((context, next) =>
|
|
|
|
|
{
|
|
|
|
|
var req = context.Request;
|
|
|
|
|
Console.WriteLine($"{req.Method}: {req.Path}{req.QueryString}");
|
|
|
|
|
return next.Invoke();
|
|
|
|
|
});
|
|
|
|
|
// app.Use((context, next) =>
|
|
|
|
|
// {
|
|
|
|
|
// var req = context.Request;
|
|
|
|
|
// Console.WriteLine($"{req.Method}: {req.Path}{req.QueryString}");
|
|
|
|
|
// return next.Invoke();
|
|
|
|
|
// });
|
|
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
@ -71,6 +75,7 @@ if (app.Environment.IsDevelopment())
|
|
|
|
|
app.UseSwaggerUI();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.UseHttpLogging();
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
app.UseCors("cors");
|
|
|
|
|
|
|
|
|
|