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