From a09f78a49620f01b0b47e1ddfed3002edfb8e4c0 Mon Sep 17 00:00:00 2001 From: Mia Winter Date: Sat, 13 Jan 2024 15:18:17 +0100 Subject: [PATCH] Added server render components and controllers support --- Wave/Program.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Wave/Program.cs b/Wave/Program.cs index b753aec..c5ed446 100644 --- a/Wave/Program.cs +++ b/Wave/Program.cs @@ -5,12 +5,13 @@ using Wave.Components; using Wave.Components.Account; using Wave.Data; +using Wave.Services; var builder = WebApplication.CreateBuilder(args); builder.Configuration.AddEnvironmentVariables("WAVE_"); -// Add services to the container. -builder.Services.AddRazorComponents(); +builder.Services.AddRazorComponents().AddInteractiveServerComponents(); +builder.Services.AddControllers(); #region Authentication & Authorization @@ -51,6 +52,7 @@ builder.Services.AddLocalization(options => { options.ResourcesPath = "Resources"; }); +builder.Services.AddScoped(); #endregion @@ -66,11 +68,13 @@ app.UseStaticFiles(); app.UseAntiforgery(); -app.MapRazorComponents(); +app.MapRazorComponents().AddInteractiveServerRenderMode(); // Add additional endpoints required by the Identity /Account Razor components. app.MapAdditionalIdentityEndpoints(); +app.MapControllers(); + string[] cultures = ["en-US", "en-GB", "de-DE"]; app.UseRequestLocalization(new RequestLocalizationOptions { ApplyCurrentCultureToResponseHeaders = true,