Program.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using Microsoft.AspNetCore.Hosting.StaticWebAssets;
  2. using RackPeek.Web.Components;
  3. namespace RackPeek.Web;
  4. public class Program
  5. {
  6. public static void Main(string[] args)
  7. {
  8. var builder = WebApplication.CreateBuilder(args);
  9. StaticWebAssetsLoader.UseStaticWebAssets(
  10. builder.Environment,
  11. builder.Configuration
  12. );
  13. // Add services to the container.
  14. builder.Services.AddRazorComponents()
  15. .AddInteractiveServerComponents();
  16. var app = builder.Build();
  17. // Configure the HTTP request pipeline.
  18. if (!app.Environment.IsDevelopment())
  19. {
  20. app.UseExceptionHandler("/Error");
  21. // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
  22. app.UseHsts();
  23. }
  24. app.UseStatusCodePagesWithReExecute("/not-found", createScopeForStatusCodePages: true);
  25. app.UseHttpsRedirection();
  26. app.UseStaticFiles();
  27. app.UseAntiforgery();
  28. app.MapStaticAssets();
  29. app.MapRazorComponents<App>()
  30. .AddInteractiveServerRenderMode();
  31. app.Run();
  32. }
  33. }