Blog/Program.cs 714 B · 28 lines · raw · history

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