Blog/Program.cs 730 B · 30 lines · raw · history

1 using Blog.Components;
2 using Blog.Services;
3
4 var builder = WebApplication.CreateBuilder(args);
5
6 // Add services to the container.
7 builder.Services.AddRazorComponents();
8
9 builder.Services.AddHttpClient();
10 builder.Services.AddHybridCache();
11 builder.Services.AddSingleton<BrpService>();
12
13 var app = builder.Build();
14
15 // Configure the HTTP request pipeline.
16 if (!app.Environment.IsDevelopment())
17 {
18 app.UseExceptionHandler("/Error", createScopeForErrors: true);
19 // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
20 app.UseHsts();
21 }
22
23 app.UseHttpsRedirection();
24
25 app.UseAntiforgery();
26
27 app.MapStaticAssets();
28 app.MapRazorComponents<App>();
29
30 app.Run();