From bb4a0238bebc11121e5cf85706944b27ee1dbea2 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Sat, 5 Aug 2023 21:01:47 +0100 Subject: [PATCH] feat: map controllers --- oliverbooth.dev/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/oliverbooth.dev/Program.cs b/oliverbooth.dev/Program.cs index 0b42b14..13ead3c 100644 --- a/oliverbooth.dev/Program.cs +++ b/oliverbooth.dev/Program.cs @@ -1,9 +1,13 @@ +using System.Globalization; using Microsoft.AspNetCore.Localization; +using OliverBooth; using OliverBooth.Middleware; WebApplicationBuilder builder = WebApplication.CreateBuilder(args); builder.Services.AddLocalization(options => options.ResourcesPath = "Resources"); builder.Services.AddRazorPages().AddViewLocalization().AddDataAnnotationsLocalization(); + +builder.Services.AddControllersWithViews(); builder.Services.AddRouting(options => options.LowercaseUrls = true); var supportedCultures = new[] @@ -42,6 +46,8 @@ app.UseRequestLocalization(options => options.SupportedUICultures = supportedCultures; options.RequestCultureProviders.Insert(0, new RouteCultureProvider(supportedCultures[0])); }); + +app.MapControllers(); app.UseCultureRedirect(); app.MapControllerRoute("default", "{culture=en}/{controller=Home}/{action=Index}/{id?}"); app.MapRazorPages();