Add our beloved Middleware Papieskie πŸ’›πŸ’›

This commit is contained in:
femsci 2023-11-18 01:20:31 +01:00
parent 3135428fb2
commit b255abc5c7
Signed by: femsci
GPG key ID: 08F7911F0E650C67
5 changed files with 9 additions and 34 deletions

View file

@ -6,7 +6,7 @@
<NotFound> <NotFound>
<PageTitle>Not found</PageTitle> <PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)"> <LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p> <p role="alert">Sorri but we slipped and forgor the location πŸ’€</p>
</LayoutView> </LayoutView>
</NotFound> </NotFound>
</Router> </Router>

View file

@ -1,12 +0,0 @@
namespace Nyanlabs.Umogen.Server.Data;
public class WeatherForecast
{
public DateOnly Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}

View file

@ -1,19 +0,0 @@
namespace Nyanlabs.Umogen.Server.Data;
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
public Task<WeatherForecast[]> GetForecastAsync(DateOnly startDate)
{
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}

View file

@ -4,6 +4,10 @@
<ProjectReference Include="..\Nyanlabs.Umogen.Core\Nyanlabs.Umogen.Core.csproj" /> <ProjectReference Include="..\Nyanlabs.Umogen.Core\Nyanlabs.Umogen.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Femsci.AspapajNet" Version="1.0.2" />
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>

View file

@ -1,11 +1,11 @@
using Nyanlabs.Umogen.Server.Data; using Femsci.AspapajNet;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
// Add services to the container. // Add services to the container.
builder.Services.AddRazorPages(); builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor(); builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>(); builder.Services.AddPapiez();
var app = builder.Build(); var app = builder.Build();
@ -18,6 +18,8 @@ if (!app.Environment.IsDevelopment())
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UsePapiez();
app.UseStaticFiles(); app.UseStaticFiles();
app.UseRouting(); app.UseRouting();