2026-03-19 13:35:53 +01:00
|
|
|
using CPATapi.Server.Interfaces;
|
|
|
|
|
using CPATapi.Server.Repository;
|
2026-03-19 14:31:05 +01:00
|
|
|
using Serilog;
|
2026-03-19 13:35:53 +01:00
|
|
|
|
2026-03-18 11:38:04 +01:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
2026-03-18 11:27:11 +01:00
|
|
|
|
2026-03-19 14:31:05 +01:00
|
|
|
builder.Services.AddSerilog(config =>
|
|
|
|
|
{
|
|
|
|
|
config
|
|
|
|
|
.ReadFrom.Configuration(builder.Configuration)
|
|
|
|
|
.Enrich.WithClientIp()
|
|
|
|
|
.Enrich.WithCorrelationId()
|
|
|
|
|
.Enrich.WithRequestHeader("User-Agent")
|
|
|
|
|
.WriteTo.Console();
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-19 13:35:53 +01:00
|
|
|
builder.Services.AddTransient<ITapiDirectoryRepository, TapiDirectoryRepository>();
|
|
|
|
|
builder.Services.AddTransient<IZeitConsensRepository, ZeitConsensRepository>();
|
|
|
|
|
|
2026-03-18 11:38:04 +01:00
|
|
|
builder.Services.AddControllers();
|
|
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
2026-03-19 14:31:05 +01:00
|
|
|
app.UseSerilogRequestLogging();
|
|
|
|
|
|
2026-03-18 11:38:04 +01:00
|
|
|
if (app.Environment.IsDevelopment())
|
2026-03-18 11:27:11 +01:00
|
|
|
{
|
2026-03-18 11:38:04 +01:00
|
|
|
app.UseDeveloperExceptionPage();
|
2026-03-18 11:27:11 +01:00
|
|
|
}
|
2026-03-18 11:38:04 +01:00
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
2026-03-19 13:35:53 +01:00
|
|
|
await app.RunAsync();
|