2024-04-21 13:35:23 +04:00
|
|
|
using ConfectioneryBusinessLogic.BusinessLogics;
|
|
|
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
|
|
|
using ConfectioneryContracts.StoragesContracts;
|
|
|
|
using ConfectioneryDatabaseImplement.Implements;
|
|
|
|
using Microsoft.OpenApi.Models;
|
|
|
|
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
2024-04-22 23:44:49 +04:00
|
|
|
builder.Logging.AddLog4Net("log4net.config");
|
2024-04-21 13:35:23 +04:00
|
|
|
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddTransient<IClientStorage, ClientStorage>();
|
|
|
|
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
|
|
|
|
builder.Services.AddTransient<IPastryStorage, PastryStorage>();
|
|
|
|
|
|
|
|
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
|
|
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
|
|
|
builder.Services.AddTransient<IPastryLogic, PastryLogic>();
|
|
|
|
|
|
|
|
builder.Services.AddControllers();
|
|
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
|
|
builder.Services.AddSwaggerGen(c =>
|
|
|
|
{
|
2024-04-22 23:44:49 +04:00
|
|
|
c.SwaggerDoc("v1", new OpenApiInfo { Title = "ConfectioneryRestApi", Version = "v1" });
|
2024-04-21 13:35:23 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
var app = builder.Build();
|
|
|
|
|
|
|
|
// Configure the HTTP request pipeline.
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
|
|
{
|
|
|
|
app.UseSwagger();
|
2024-05-05 00:58:09 +04:00
|
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "ConfectioneryRestApi v1"));
|
2024-04-21 13:35:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
|
|
|
|
app.UseAuthorization();
|
|
|
|
|
|
|
|
app.MapControllers();
|
|
|
|
|
|
|
|
app.Run();
|