using Microsoft.EntityFrameworkCore; using Server; var builder = WebApplication.CreateBuilder(args); builder.WebHost.UseStaticWebAssets(); // Add services to the container. builder.Services.AddControllersWithViews(); builder.Services.AddRazorPages(); var connectionString = builder.Configuration.GetConnectionString("DefaultConnection"); builder.Services.AddDbContext(options => options.UseNpgsql(connectionString)); var app = builder.Build(); // Apply migrations using (var scope = app.Services.CreateScope()) { var db = scope.ServiceProvider.GetRequiredService(); db.Database.Migrate(); } // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseWebAssemblyDebugging(); } else { app.UseExceptionHandler("/Error"); } app.UseBlazorFrameworkFiles(); app.UseStaticFiles(); app.UseRouting(); app.MapRazorPages(); app.MapControllers(); app.MapFallbackToFile("index.html"); app.Run();