using Microsoft.EntityFrameworkCore; using Microsoft.OpenApi.Models; using PRSA.DAL.DB; using PRSA.Services.FileUploads; var builder = WebApplication.CreateBuilder(args); // Getting connection string var connectionString = builder.Configuration.GetConnectionString("PRSA"); builder.Services.AddDbContext(x => x.UseSqlServer(connectionString)); // Add services to the container. builder.Services.AddControllers(); builder.Services.AddScoped(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Title = "PRSA.API", Version = "v1" }); }); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "PRSA.API v1")); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.Run();