PIbd-22_Karamushko_M_K_Pizz.../Pizzeria/PizzeriaRestApi/Program.cs

42 lines
1.3 KiB
C#
Raw Normal View History

2023-03-28 08:52:39 +04:00
using PizzeriaBusinessLogic;
using PizzeriaContracts.BusinessLogicsContracts;
using PizzeriaContracts.StoragesContracts;
using PizzeriaDatabaseImplement.Implements;
using Microsoft.OpenApi.Models;
2023-03-27 23:45:20 +04:00
2023-03-28 08:52:39 +04:00
var builder = WebApplication.CreateBuilder(args);
builder.Logging.SetMinimumLevel(LogLevel.Trace);
builder.Logging.AddLog4Net("log4net.config");
2023-03-27 23:45:20 +04:00
// Add services to the container.
2023-03-28 08:52:39 +04:00
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IOrderStorage, OrderStorage>();
builder.Services.AddTransient<IPizzaStorage, PizzaStorage>();
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddTransient<IPizzaLogic, PizzaLogic>();
2023-03-27 23:45:20 +04:00
builder.Services.AddControllers();
2023-03-28 08:52:39 +04:00
// Learn more about configuring Swagger/OpenAPI at
https://aka.ms/aspnetcore/swashbuckle
2023-03-27 23:45:20 +04:00
builder.Services.AddEndpointsApiExplorer();
2023-03-28 08:52:39 +04:00
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Title = "AbstractShopRestApi",
Version
= "v1"
});
});
2023-03-27 23:45:20 +04:00
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
2023-03-28 08:52:39 +04:00
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json",
"AbstractShopRestApi v1"));
2023-03-27 23:45:20 +04:00
}
app.UseAuthorization();
app.MapControllers();
app.Run();
2023-03-28 08:52:39 +04:00