From dee66532141612689dbccb4902e09d255057c581 Mon Sep 17 00:00:00 2001 From: Mia Winter Date: Sat, 18 Nov 2023 13:41:14 +0100 Subject: [PATCH] added: blazor static component rendering support --- Components/App.razor | 25 +++++++++++++++++++++++++ Components/Layout/MainLayout.razor | 3 +++ Components/Pages/About.razor | 9 +++++++++ Components/Routes.razor | 6 ++++++ Components/_imports.razor | 10 ++++++++++ Program.cs | 6 ++++++ 6 files changed, 59 insertions(+) create mode 100644 Components/App.razor create mode 100644 Components/Layout/MainLayout.razor create mode 100644 Components/Pages/About.razor create mode 100644 Components/Routes.razor create mode 100644 Components/_imports.razor diff --git a/Components/App.razor b/Components/App.razor new file mode 100644 index 0000000..79636e8 --- /dev/null +++ b/Components/App.razor @@ -0,0 +1,25 @@ + + + +@* ReSharper disable once MissingTitleTag :: Added by HeadOutlet *@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Components/Layout/MainLayout.razor b/Components/Layout/MainLayout.razor new file mode 100644 index 0000000..53a4e95 --- /dev/null +++ b/Components/Layout/MainLayout.razor @@ -0,0 +1,3 @@ +@inherits LayoutComponentBase + +@Body \ No newline at end of file diff --git a/Components/Pages/About.razor b/Components/Pages/About.razor new file mode 100644 index 0000000..e05344f --- /dev/null +++ b/Components/Pages/About.razor @@ -0,0 +1,9 @@ +@page "/about" + +About - Just Short It + +

About

+ +@code { + +} diff --git a/Components/Routes.razor b/Components/Routes.razor new file mode 100644 index 0000000..eb2c867 --- /dev/null +++ b/Components/Routes.razor @@ -0,0 +1,6 @@ + + + + + + diff --git a/Components/_imports.razor b/Components/_imports.razor new file mode 100644 index 0000000..d7fd106 --- /dev/null +++ b/Components/_imports.razor @@ -0,0 +1,10 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using JustShortIt +@using JustShortIt.Components diff --git a/Program.cs b/Program.cs index 9ae145b..3b1bce1 100644 --- a/Program.cs +++ b/Program.cs @@ -1,3 +1,4 @@ +using JustShortIt.Components; using JustShortIt.Model; using JustShortIt.Service; using Microsoft.AspNetCore.Authentication.Cookies; @@ -6,6 +7,9 @@ builder.Configuration.AddEnvironmentVariables("JSI_"); builder.Services.AddRazorPages(); +builder.Services.AddAntiforgery(); +builder.Services.AddRazorComponents(); + // Get Configurations var redisConnection = builder.Configuration.GetSection("Redis").Get(); var user = builder.Configuration.GetSection("Account").Get(); @@ -65,5 +69,7 @@ app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); +app.UseAntiforgery(); app.MapRazorPages(); +app.MapRazorComponents(); app.Run(); \ No newline at end of file