using Microsoft.EntityFrameworkCore; using SpotiParty.Web; using SpotiParty.Web.Components; using SpotiParty.Web.Services; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); builder.AddServiceDefaults(); builder.AddNpgsqlDbContext("SpotiParty"); builder.Services.AddScoped(); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } await using (var scope = app.Services.CreateAsyncScope()) { var context = scope.ServiceProvider.GetRequiredService(); await context.Database.MigrateAsync(); } app.MapDefaultEndpoints(); app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true); //app.UseHttpsRedirection(); app.UseAntiforgery(); app.MapStaticAssets(); app.MapRazorComponents() .AddInteractiveServerRenderMode(); app.Run();