using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; using Scalar.AspNetCore; using Trazo.Model; var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); // Add services to the container. builder.Services.AddAuthorization(); builder.Services.AddIdentity>(options => { options.SignIn.RequireConfirmedAccount = true; options.Password.RequiredLength = 8; }) .AddEntityFrameworkStores() .AddSignInManager(); builder.Services.AddDbContext(options => options.UseNpgsql(builder.Configuration.GetConnectionString("Database"))); // CORS builder.Services.AddCors(options => { options.AddPolicy("ApiPolicy", builder => { builder.WithOrigins("http://localhost") .AllowAnyMethod() .AllowAnyHeader(); }); }); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(options => { options.SupportNonNullableReferenceTypes(); } ); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(options => { options.RouteTemplate = "openapi/{documentName}.json"; }); app.MapScalarApiReference(); } app.UseCors("ApiPolicy"); app.UseAuthentication(); app.UseAuthorization(); /*app.MapIdentityApi();*/ app.MapControllers(); app.Run();