49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using BusinessLogic.BusinessLogic;
|
|
using Contracts.BusinessLogicContracts;
|
|
using Contracts.StorageContracts;
|
|
using DatabaseImplement.Implements;
|
|
using Microsoft.OpenApi.Models;
|
|
using System;
|
|
|
|
const string VERSION = "v1";
|
|
const string TITLE = "21GunsRestAPI";
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Logging.SetMinimumLevel(LogLevel.Trace);
|
|
builder.Logging.AddLog4Net("log4net.config");
|
|
|
|
#region DI
|
|
|
|
builder.Services.AddTransient<IRoleLogic, RoleLogic>();
|
|
builder.Services.AddTransient<IUserLogic, UserLogic>();
|
|
|
|
builder.Services.AddTransient<IRoleStorage, RoleStorage>();
|
|
builder.Services.AddTransient<IUserStorage, UserStorage>();
|
|
|
|
#endregion DI
|
|
|
|
builder.Services.AddControllers();
|
|
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
|
builder.Services.AddEndpointsApiExplorer();
|
|
builder.Services.AddSwaggerGen(c =>
|
|
{
|
|
c.SwaggerDoc(VERSION, new OpenApiInfo { Title = TITLE, Version = VERSION });
|
|
});
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI(c => c.SwaggerEndpoint($"/swagger/{VERSION}/swagger.json", $"{TITLE} {VERSION}"));
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
|
|
app.Run(); |