main
Last change
on this file since 8f8226c was 2639fab, checked in by ElenaMoskova <elena.moskova99@…>, 3 months ago |
Update with triggers
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | using Microsoft.AspNetCore.Identity;
|
---|
2 | using Microsoft.EntityFrameworkCore;
|
---|
3 | using PostgreSqlDotnetCore.Data;
|
---|
4 | using PostgreSqlDotnetCore.Models;
|
---|
5 |
|
---|
6 | var builder = WebApplication.CreateBuilder(args);
|
---|
7 |
|
---|
8 | // Add services to the container.
|
---|
9 | var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
|
---|
10 | builder.Services.AddDbContext<ApplicationDbContext>(options =>
|
---|
11 | options.UseNpgsql(connectionString));
|
---|
12 | builder.Services.AddDatabaseDeveloperPageExceptionFilter();
|
---|
13 |
|
---|
14 | builder.Services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
|
---|
15 | .AddEntityFrameworkStores<ApplicationDbContext>();
|
---|
16 | builder.Services.AddControllersWithViews();
|
---|
17 |
|
---|
18 | var app = builder.Build();
|
---|
19 |
|
---|
20 | // Configure the HTTP request pipeline.
|
---|
21 | if (app.Environment.IsDevelopment())
|
---|
22 | {
|
---|
23 | app.UseMigrationsEndPoint();
|
---|
24 | }
|
---|
25 | else
|
---|
26 | {
|
---|
27 | app.UseExceptionHandler("/Home/Error");
|
---|
28 | // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
---|
29 | app.UseHsts();
|
---|
30 | }
|
---|
31 |
|
---|
32 | app.UseHttpsRedirection();
|
---|
33 | app.UseStaticFiles();
|
---|
34 |
|
---|
35 | app.UseRouting();
|
---|
36 |
|
---|
37 | app.UseAuthorization();
|
---|
38 |
|
---|
39 | app.MapControllerRoute(
|
---|
40 | name: "default",
|
---|
41 | pattern: "{controller=Home}/{action=Index}/{id?}");
|
---|
42 | app.MapRazorPages();
|
---|
43 |
|
---|
44 | app.Run();
|
---|
Note:
See
TracBrowser
for help on using the repository browser.