Files
Flypaper/src/Flypaper.Web/Program.cs
T

33 lines
901 B
C#

using Flypaper.Core;
using Flypaper.Http;
using Flypaper.Storage;
using Flypaper.Web.Components;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.ConfigureKestrel(options => options.AddServerHeader = false);
builder.Services.AddRazorComponents();
builder.Services.AddFlypaperCore(builder.Configuration);
builder.Services.AddFlypaperHttp(builder.Configuration);
builder.Services.AddFlypaperStorage(builder.Configuration.GetConnectionString("Flypaper") ?? "Data Source=flypaper.db");
var app = builder.Build();
await app.Services.MigrateFlypaperDatabaseAsync();
app.UseFlypaper();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", createScopeForErrors: true);
}
app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
app.UseAntiforgery();
app.MapStaticAssets();
app.MapRazorComponents<App>();
await app.RunAsync();