Blog/Program.cs 990 B · 39 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 .AddInteractiveServerComponents();
9
10 builder.Services.AddHttpClient();
11 builder.Services.AddHybridCache();
12 builder.Services.AddHttpClient<BrpService>(
13 client =>
14 {
15 client.BaseAddress = new Uri("https://brp.bes.is/");
16 });
17
18 // builder.Services.AddTransient<BrpService>();
19 // builder.Services.AddTransient<NsService>();
20
21 var app = builder.Build();
22
23 // Configure the HTTP request pipeline.
24 if (!app.Environment.IsDevelopment())
25 {
26 app.UseExceptionHandler("/Error", createScopeForErrors: true);
27 // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
28 app.UseHsts();
29 }
30
31 app.UseHttpsRedirection();
32
33 app.UseAntiforgery();
34
35 app.MapStaticAssets();
36 app.MapRazorComponents<App>()
37 .AddInteractiveServerRenderMode();
38
39 app.Run();