-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathProgram.cs
39 lines (25 loc) · 952 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Northwind.EntityModels; // To use AddNorthwindContext method.
using Northwind.Web.Components; // To use App.
#region Configure the web server host and services.
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents();
builder.Services.AddNorthwindContext();
var app = builder.Build();
#endregion
#region Configure the HTTP pipeline and routes
if (!app.Environment.IsDevelopment())
{
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseAntiforgery();
app.UseDefaultFiles(); // index.html, default.html, and so on.
app.MapStaticAssets(); // .NET 9 or later.
//app.UseStaticFiles(); // .NET 8 or earlier.
app.MapRazorComponents<App>();
app.MapGet("/env", () =>
$"Environment is {app.Environment.EnvironmentName}");
#endregion
// Start the web server, host the website, and wait for requests.
app.Run(); // This is a thread-blocking call.
WriteLine("This executes after the web server has stopped!");