Na most működik az API + adatbázis
This commit is contained in:
@@ -5,19 +5,33 @@ using System.Text.Json.Serialization;
|
||||
using WorkFlowCheck.API;
|
||||
using WorkFlowCheck.DL;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Serilog;
|
||||
using WorkFlowCheck.BL.Mappings;
|
||||
using WorkFlowCheck.BL.Infra;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.WebHost.ConfigureKestrel(options =>
|
||||
{
|
||||
options.ListenAnyIP(5069, listenOptions =>
|
||||
{
|
||||
listenOptions.UseHttps(Path.Combine(AppContext.BaseDirectory, "Certs", "SwaggerCert.pfx"), "Noispot135!Xy()zz654321");
|
||||
});
|
||||
});
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.WriteTo.Console() // Logok írása a konzolra
|
||||
.WriteTo.File("logs/WorkFlowCheck.log", rollingInterval: RollingInterval.Day) // Logok fájlba
|
||||
.CreateLogger();
|
||||
|
||||
//builder.WebHost.ConfigureKestrel(options =>
|
||||
//{
|
||||
// options.ListenAnyIP(5069, listenOptions =>
|
||||
// {
|
||||
// listenOptions.UseHttps(Path.Combine(AppContext.BaseDirectory, "Certs", "SwaggerCert.pfx"), "Noispot135!Xy()zz654321");
|
||||
// });
|
||||
//});
|
||||
builder.Services.AddAutoMapper(typeof(MapperProfile));
|
||||
|
||||
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection");
|
||||
|
||||
builder.Services.AddDbContext<AppDbContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
|
||||
options.UseSqlServer(connectionString));
|
||||
//DI
|
||||
|
||||
DIConfig.DIInit(builder.Services);
|
||||
|
||||
// SWAGGER !!!
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
@@ -54,6 +68,8 @@ builder.Services.AddSwaggerGen(c =>
|
||||
});
|
||||
});
|
||||
|
||||
builder.Host.UseSerilog();
|
||||
|
||||
builder.Services.AddControllers()
|
||||
.AddNewtonsoftJson(options =>
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user