/
smik912
/
UsedCarHub
Обзор
Документация
Войти
/
smik912
/
UsedCarHub
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
UsedCarHub.API/Program.cs
55 строк
2 KB
smik91
FixAppSettings
26 апр 2024, 00:59
26 апр 2024, 00:59
7072855
Код
Авторство
О чём код?
using Microsoft.AspNetCore.CookiePolicy; using Microsoft.EntityFrameworkCore; using UsedCarHub.API.Extensions; using UsedCarHub.BusinessLogic.AutoMapperConfiguration; using UsedCarHub.Domain; namespace UsedCarHub.API { public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); builder.Services.AddCustomServices(); builder.Services.AddAuthenticationServices(builder.Configuration); builder.Services.AddAutoMapper(typeof(AppMappingProfile)); var connection = builder.Configuration.GetConnectionString(name: "PostgreSqlConnectionString"); builder.Services.AddDbContext<AppDbContext>(options => options.UseNpgsql(connection)); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = SameSiteMode.None, HttpOnly = HttpOnlyPolicy.Always, Secure = CookieSecurePolicy.Always }); app.UseHttpsRedirection(); app.UseCookieProvider(); app.UseAuthentication(); app.UseAuthorization(); app.MapControllers(); app.Run(); } } }