Files
blog.stevanfreeborn.com/src/Blog/Program.cs
T

32 lines
707 B
C#
Raw Normal View History

2024-04-02 15:35:57 -05:00
var builder = WebApplication.CreateBuilder(args);
2024-04-10 01:28:38 -05:00
builder.Services.ConfigureOptions<FilePostServiceOptionsSetup>();
builder.Services.AddSingleton<IFileSystem, FileSystem>();
builder.Services.AddScoped<IPostService, FilePostService>();
2024-04-03 12:02:00 -05:00
builder.Services
.AddRazorComponents()
.AddInteractiveServerComponents();
2024-04-02 15:35:57 -05:00
var app = builder.Build();
2024-04-03 12:02:00 -05:00
if (app.Environment.IsProduction())
2024-04-02 15:35:57 -05:00
{
2024-04-03 12:02:00 -05:00
app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseHsts();
2024-04-02 15:35:57 -05:00
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
2024-04-03 12:02:00 -05:00
app
.MapRazorComponents<App>()
.AddInteractiveServerRenderMode();
2024-04-02 15:35:57 -05:00
2024-04-10 01:28:38 -05:00
app.UseStatusCodePagesWithRedirects("/Error/{0}");
2024-04-08 23:34:32 -05:00
app.Run();
2024-04-10 01:28:38 -05:00
public partial class Program { }