1.0.4
This commit is contained in:
parent
6cbe7b971c
commit
55775cc590
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
pre_commit.ps1
|
||||||
|
pre_commit.log
|
||||||
# User-specific files
|
# User-specific files
|
||||||
*.suo
|
*.suo
|
||||||
*.user
|
*.user
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
using System.Reflection;
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
using APP_LOGGING.Services.AppLoggingService;
|
using APP_LOGGING.Services.AppLoggingService;
|
||||||
using APP_LOGGING.Services.AppLoggingService.Implements;
|
using APP_LOGGING.Services.AppLoggingService.Implements;
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
namespace APP_LOGGING.Services.AppLoggingService;
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace APP_LOGGING.Services.AppLoggingService;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Интерфейс логирования
|
/// Интерфейс логирования
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
using System.Text;
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
using APP_LOGGING.Accessories.LoggingAccessories;
|
using APP_LOGGING.Accessories.LoggingAccessories;
|
||||||
using APP_LOGGING.Services.AppLoggingService;
|
using APP_LOGGING.Services.AppLoggingService;
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
using System.Text.Json;
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
namespace APP_UTILITIES.FormatsData.AppEnumsData;
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace APP_UTILITIES.FormatsData.AppEnumsData;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Перечисление на чьей стороне возникла ошибка
|
/// Перечисление на чьей стороне возникла ошибка
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
using System.Text.Json.Serialization;
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace APP_UTILITIES.FormatsData.AppResponseData.BadResponses;
|
namespace APP_UTILITIES.FormatsData.AppResponseData.BadResponses;
|
||||||
|
|
||||||
|
@ -1,4 +1,12 @@
|
|||||||
using APP_LOGGING.Accessories.LoggingAccessories;
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
|
using APP_LOGGING.Accessories.LoggingAccessories;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Antiforgery;
|
using Microsoft.AspNetCore.Antiforgery;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using AppWeb.Models;
|
using AppWeb.Models;
|
||||||
@ -5,23 +13,23 @@ using AppWeb.Models;
|
|||||||
namespace AppWeb.Controllers
|
namespace AppWeb.Controllers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Главный контроллер
|
/// Главный контроллер
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<HomeController> _logger;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">Логирование MVC</param>
|
/// <param name="logger">Логирование MVC</param>
|
||||||
public HomeController(ILogger<HomeController> logger)
|
public HomeController(ILogger<HomeController> logger)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Главная
|
/// Главная
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/")]
|
[Route("/")]
|
||||||
@ -31,7 +39,7 @@ namespace AppWeb.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Контакты
|
/// Контакты
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/contacts")]
|
[Route("/contacts")]
|
||||||
@ -41,7 +49,7 @@ namespace AppWeb.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ошибка
|
/// Ошибка
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Route("/error")]
|
[Route("/error")]
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
namespace AppWeb.Models
|
namespace AppWeb.Models
|
||||||
{
|
{
|
||||||
public class ErrorViewModel
|
public class ErrorViewModel
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
/*
|
||||||
|
* Author: Nikolay Dvurechensky
|
||||||
|
* Site: https://www.dvurechensky.pro/
|
||||||
|
* Gmail: dvurechenskysoft@gmail.com
|
||||||
|
* Last Updated: 12 мая 2025 06:05:33
|
||||||
|
* Version: 1.0.5
|
||||||
|
*/
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
||||||
@ -17,20 +25,20 @@ builder.WebHost.UseUrls($"https://{builder.Configuration["appSettings:appHost"]}
|
|||||||
|
|
||||||
builder.Services.AddControllersWithViews();
|
builder.Services.AddControllersWithViews();
|
||||||
|
|
||||||
#region В этом регионе объявляем сервисы
|
#region В этом регионе объявляем сервисы
|
||||||
|
|
||||||
// Например
|
// Например
|
||||||
// builder.Services.AddSingleton<ICashService, CashService>();
|
// builder.Services.AddSingleton<ICashService, CashService>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
builder.Services.Configure<JsonOptions>(options =>
|
builder.Services.Configure<JsonOptions>(options =>
|
||||||
{
|
{
|
||||||
options.JsonSerializerOptions.WriteIndented = true; //для красивого форматирования
|
options.JsonSerializerOptions.WriteIndented = true; //для красивого форматирования
|
||||||
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
options.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
|
||||||
});
|
});
|
||||||
|
|
||||||
//настройки службы против подделки запросов
|
//настройки службы против подделки запросов
|
||||||
builder.Services.AddAntiforgery(options =>
|
builder.Services.AddAntiforgery(options =>
|
||||||
{
|
{
|
||||||
options.HeaderName = "X-CSRF-TOKEN";
|
options.HeaderName = "X-CSRF-TOKEN";
|
||||||
@ -42,7 +50,7 @@ builder.Services.AddSwaggerGen(options =>
|
|||||||
{
|
{
|
||||||
Title = "App API",
|
Title = "App API",
|
||||||
Version = "1.0.0",
|
Version = "1.0.0",
|
||||||
Description = "Информация об API",
|
Description = "Информация об API",
|
||||||
Contact = new OpenApiContact
|
Contact = new OpenApiContact
|
||||||
{
|
{
|
||||||
Name = "Dvurechensky"
|
Name = "Dvurechensky"
|
||||||
@ -58,13 +66,13 @@ var app = builder.Build();
|
|||||||
var appLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
|
var appLifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
|
||||||
|
|
||||||
appLifetime.ApplicationStarted.Register(async () =>
|
appLifetime.ApplicationStarted.Register(async () =>
|
||||||
{ //инициализируем сервис логирования
|
{ //инициализируем сервис логирования
|
||||||
LoggingExtensions.Logging.InitializeLogging("API Reagent Project Control");
|
LoggingExtensions.Logging.InitializeLogging("API Reagent Project Control");
|
||||||
});
|
});
|
||||||
|
|
||||||
appLifetime.ApplicationStopping.Register(() =>
|
appLifetime.ApplicationStopping.Register(() =>
|
||||||
{
|
{
|
||||||
LoggingExtensions.Logging.DeinitializeLogging(); //выключаем сервис логирования
|
LoggingExtensions.Logging.DeinitializeLogging(); //выключаем сервис логирования
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!app.Environment.IsDevelopment())
|
if (!app.Environment.IsDevelopment())
|
||||||
@ -77,20 +85,20 @@ else
|
|||||||
app.UseSwagger();
|
app.UseSwagger();
|
||||||
app.UseSwaggerUI(c =>
|
app.UseSwaggerUI(c =>
|
||||||
{
|
{
|
||||||
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Документация");
|
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Документация");
|
||||||
c.RoutePrefix = "docs";
|
c.RoutePrefix = "docs";
|
||||||
});
|
});
|
||||||
app.UseDeveloperExceptionPage(); //используем страницу исключений
|
app.UseDeveloperExceptionPage(); //используем страницу исключений
|
||||||
}
|
}
|
||||||
|
|
||||||
app.UseCookiePolicy(); //использовать политику куки
|
app.UseCookiePolicy(); //использовать политику куки
|
||||||
|
|
||||||
// app.UseHttpsRedirection();
|
// app.UseHttpsRedirection();
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
app.UseMiddleware<AntiforgeryMiddleware>(); //обработчик службы против подделки запросов
|
app.UseMiddleware<AntiforgeryMiddleware>(); //обработчик службы против подделки запросов
|
||||||
app.UseAuthorization();
|
app.UseAuthorization();
|
||||||
|
|
||||||
app.MapControllerRoute(
|
app.MapControllerRoute(
|
||||||
|
Loading…
Reference in New Issue
Block a user