2023-05-17 16:00:50 +10:00
|
|
|
using FluentValidation;
|
2023-05-17 16:30:13 +10:00
|
|
|
using PARR.API.Installers;
|
2023-08-25 11:29:00 +10:00
|
|
|
using PARR.BLL;
|
2023-05-17 16:30:13 +10:00
|
|
|
using PARR.DAL;
|
2023-05-17 16:00:50 +10:00
|
|
|
using Serilog;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
2023-05-17 15:17:00 +10:00
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
2023-05-17 16:00:50 +10:00
|
|
|
builder.Host.UseSerilog((context, config) =>
|
|
|
|
|
{
|
|
|
|
|
config
|
|
|
|
|
.WriteTo.Console()
|
|
|
|
|
.ReadFrom.Configuration(builder.Configuration);
|
|
|
|
|
});
|
|
|
|
|
|
2023-05-17 15:17:00 +10:00
|
|
|
// Add services to the container.
|
2023-05-17 16:30:13 +10:00
|
|
|
builder.Services.InstallDalServices(builder.Configuration);
|
2023-08-25 11:29:00 +10:00
|
|
|
builder.Services.InstallBllServices(builder.Configuration);
|
2023-05-17 16:00:50 +10:00
|
|
|
builder.Services.InstallApiServices(builder.Configuration);
|
|
|
|
|
builder.Services.InstallSettings(builder.Configuration);
|
|
|
|
|
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
|
|
|
|
|
|
|
|
|
|
builder.Services.AddHttpContextAccessor();
|
2023-05-17 15:17:00 +10:00
|
|
|
|
|
|
|
|
builder.Services.AddControllers();
|
2023-05-17 16:00:50 +10:00
|
|
|
builder.Services.AddValidatorsFromAssembly(Assembly.GetExecutingAssembly());
|
|
|
|
|
|
2023-05-17 15:17:00 +10:00
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
|
builder.Services.AddSwaggerGen();
|
2023-05-17 16:00:50 +10:00
|
|
|
builder.Services.InstallSwaggerService(builder.Configuration);
|
|
|
|
|
|
2023-05-17 15:17:00 +10:00
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
2023-05-17 16:00:50 +10:00
|
|
|
app.InstallSwagger();
|
2023-05-17 15:17:00 +10:00
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
|
|
app.Run();
|