CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopRestAPI/Program.cs
Илья Федотов 1dd398772a Web
2024-05-27 14:57:41 +04:00

38 lines
1.1 KiB
C#

using ElectronicsShopBusinessLogic.BusinessLogic;
using ElectronicsShopContracts.BusinessLogicContracts;
using ElectronicsShopContracts.StorageContracts;
using ElectronicsShopDataBaseImplement.Implements;
using Microsoft.OpenApi.Models;
var builder = WebApplication.CreateBuilder(args);
//todo logger!!!
// Add services to the container.
builder.Services.AddTransient<IClientStorage, ClientStorage>();
builder.Services.AddTransient<IClientLogic, ClientLogic>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(x => x.SwaggerDoc("v1", new OpenApiInfo { Title = "ElectronicsShopRestAPI", Version = "v1" }));
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI(x => x.SwaggerEndpoint("/swagger/v1/swagger.json", "ElectronicsShopRestAPI v1"));
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();