diff --git a/STORestApi/BankRestApi.csproj b/STORestApi/BankRestApi.csproj new file mode 100644 index 0000000..3314de9 --- /dev/null +++ b/STORestApi/BankRestApi.csproj @@ -0,0 +1,25 @@ + + + + net6.0 + enable + enable + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + diff --git a/STORestApi/Program.cs b/STORestApi/Program.cs new file mode 100644 index 0000000..95b55d4 --- /dev/null +++ b/STORestApi/Program.cs @@ -0,0 +1,56 @@ +using STOBusinessLogic.BusinessLogic; +using STOContracts.BusinessLogicsContracts; +using STOContracts.StoragesContracts; +using STODatabaseImplement.Implements; +using Microsoft.OpenApi.Models; +using NLog.Extensions.Logging; + +var builder = WebApplication.CreateBuilder(args); +builder.Logging.SetMinimumLevel(LogLevel.Trace); +builder.Logging.AddLog4Net("log4net.config"); + +// Add services to the container. + +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddTransient(); +builder.Services.AddLogging(option => +{ + option.SetMinimumLevel(LogLevel.Information); + option.AddNLog("nlog.config"); +}); +builder.Services.AddControllers(); + +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo + { + Title = "STORestApi", + Version + = "v1" + }); +}); +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", + "STORestApi v1")); +} +app.UseHttpsRedirection(); +app.UseAuthorization(); +app.MapControllers(); +app.Run(); \ No newline at end of file diff --git a/STORestApi/appsettings.Development.json b/STORestApi/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/STORestApi/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/STORestApi/appsettings.json b/STORestApi/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/STORestApi/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/STORestApi/log4net.config b/STORestApi/log4net.config new file mode 100644 index 0000000..d1bd31f --- /dev/null +++ b/STORestApi/log4net.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file