42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
|
using Serilog;
|
||
|
|
||
|
Log.Logger = new LoggerConfiguration()
|
||
|
.WriteTo.Console()
|
||
|
.WriteTo.File("logs/latest.log", rollingInterval: RollingInterval.Day)
|
||
|
#if DEBUG
|
||
|
.MinimumLevel.Debug()
|
||
|
#endif
|
||
|
.CreateLogger();
|
||
|
|
||
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||
|
builder.Configuration.AddTomlFile("data/config.toml", true, true);
|
||
|
builder.Logging.ClearProviders();
|
||
|
builder.Logging.AddSerilog();
|
||
|
|
||
|
builder.Services.AddRazorPages();
|
||
|
builder.Services.AddControllersWithViews();
|
||
|
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
|
||
|
builder.Services.AddServerSideBlazor().AddInteractiveServerComponents();
|
||
|
builder.Services.AddRouting(options => options.LowercaseUrls = true);
|
||
|
|
||
|
WebApplication app = builder.Build();
|
||
|
|
||
|
// Configure the HTTP request pipeline.
|
||
|
if (!app.Environment.IsDevelopment())
|
||
|
{
|
||
|
app.UseExceptionHandler("/Error");
|
||
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
||
|
app.UseHsts();
|
||
|
}
|
||
|
|
||
|
app.UseHttpsRedirection();
|
||
|
app.UseStaticFiles();
|
||
|
app.UseRouting();
|
||
|
app.UseAuthorization();
|
||
|
|
||
|
app.MapControllers();
|
||
|
app.MapRazorPages();
|
||
|
app.MapBlazorHub();
|
||
|
|
||
|
app.Run();
|