Create new Web Project

This commit is contained in:
Jonathan Jenne
2023-11-08 08:59:25 +01:00
parent d0a4249eb7
commit 2e148de18e
765 changed files with 173 additions and 12962 deletions

View File

@@ -1,47 +1,40 @@
using EnvelopeGenerator.Web.Services;
using EnvelopeGenerator.Web.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
var builder = WebApplication.CreateBuilder(args);
// Add basic blazor services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
// Add base services
builder.Services.AddSingleton<LoggingService>();
builder.Services.AddTransient<DatabaseService>();
// Add higher order services
builder.Services.AddSingleton<EnvelopeService>();
builder.Services.AddControllers();
builder.Services.AddLocalization();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
namespace EnvelopeGenerator.Web
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
//app.UseHsts();
}
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
// Redirect http:// to https://
//app.UseHttpsRedirection();
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
// Serve static assets like css
app.UseStaticFiles();
var app = builder.Build();
// Add a router
app.UseRouting();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
// Add controller routes
app.MapControllers();
app.UseHttpsRedirection();
// Blazor plumbing
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.UseStaticFiles();
// Get crackin'!
app.Run();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
}
}
}