source: KernelRecordsMVC.Web/Program.cs@ 08aefc6

main
Last change on this file since 08aefc6 was 08aefc6, checked in by mmilevski <markomilevski3@…>, 4 weeks ago

Initial commit

  • Property mode set to 100644
File size: 711 bytes
Line 
1using Microsoft.EntityFrameworkCore;
2using KernelRecordsMVC.Data;
3
4var builder = WebApplication.CreateBuilder(args);
5
6builder.Services.AddControllersWithViews();
7
8builder.Services.AddDbContext<KernelRecordsContext>(options =>
9 options.UseNpgsql(
10 builder.Configuration.GetConnectionString("KernelRecords")));
11
12builder.Services.AddSession();
13
14var app = builder.Build();
15
16if (!app.Environment.IsDevelopment())
17{
18 app.UseExceptionHandler("/Home/Error");
19 app.UseHsts();
20}
21
22app.UseHttpsRedirection();
23app.UseStaticFiles();
24
25app.UseRouting();
26
27app.UseSession();
28
29app.UseAuthorization();
30
31app.MapControllerRoute(
32 name: "default",
33 pattern: "{controller=Home}/{action=Index}/{id?}");
34
35app.Run();
Note: See TracBrowser for help on using the repository browser.