Added server render components and controllers support

This commit is contained in:
Mia Rose Winter 2024-01-13 15:18:17 +01:00
parent 4570124a83
commit a09f78a496
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E

View file

@ -5,12 +5,13 @@
using Wave.Components; using Wave.Components;
using Wave.Components.Account; using Wave.Components.Account;
using Wave.Data; using Wave.Data;
using Wave.Services;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddEnvironmentVariables("WAVE_"); builder.Configuration.AddEnvironmentVariables("WAVE_");
// Add services to the container. builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddRazorComponents(); builder.Services.AddControllers();
#region Authentication & Authorization #region Authentication & Authorization
@ -51,6 +52,7 @@
builder.Services.AddLocalization(options => { builder.Services.AddLocalization(options => {
options.ResourcesPath = "Resources"; options.ResourcesPath = "Resources";
}); });
builder.Services.AddScoped<ImageService>();
#endregion #endregion
@ -66,11 +68,13 @@
app.UseStaticFiles(); app.UseStaticFiles();
app.UseAntiforgery(); app.UseAntiforgery();
app.MapRazorComponents<App>(); app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
// Add additional endpoints required by the Identity /Account Razor components. // Add additional endpoints required by the Identity /Account Razor components.
app.MapAdditionalIdentityEndpoints(); app.MapAdditionalIdentityEndpoints();
app.MapControllers();
string[] cultures = ["en-US", "en-GB", "de-DE"]; string[] cultures = ["en-US", "en-GB", "de-DE"];
app.UseRequestLocalization(new RequestLocalizationOptions { app.UseRequestLocalization(new RequestLocalizationOptions {
ApplyCurrentCultureToResponseHeaders = true, ApplyCurrentCultureToResponseHeaders = true,