Blog/Program.cs 1.3 K · 44 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 // /rvrb reads the rvrb bot's stats straight off its BEAM, over Erlang distribution. The node this
19 // site dials with is started on the first request, not here - see RvrbService.
20 builder.Services.Configure<RvrbOptions>(builder.Configuration.GetSection(RvrbOptions.Section));
21 builder.Services.AddSingleton<RvrbService>();
22
23 // builder.Services.AddTransient<BrpService>();
24 // builder.Services.AddTransient<NsService>();
25
26 var app = builder.Build();
27
28 // Configure the HTTP request pipeline.
29 if (!app.Environment.IsDevelopment())
30 {
31 app.UseExceptionHandler("/Error", createScopeForErrors: true);
32 // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
33 app.UseHsts();
34 }
35
36 app.UseHttpsRedirection();
37
38 app.UseAntiforgery();
39
40 app.MapStaticAssets();
41 app.MapRazorComponents<App>()
42 .AddInteractiveServerRenderMode();
43
44 app.Run();