Files
hrynco-notification-service/HrynCo.NotificationService.Web/Program.cs
T
Anatolii Grynchuk 8a54b6de7a feat: redirect root / to /admin/templates
Ref: IT-634

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-02 02:13:19 +03:00

37 lines
1.0 KiB
C#

using HrynCo.NotificationService.Web;
using HrynCo.NotificationService.DAL.EF;
using HrynCo.NotificationService.Services;
using Scalar.AspNetCore;
var builder = WebApplication.CreateBuilder(args);
builder.AddSerilog();
var appSettings = builder.Configuration
.GetSection(AppSettings.SectionName)
.Get<AppSettings>() ?? throw new InvalidOperationException("App settings are not configured.");
builder.Services.AddSingleton(appSettings);
builder.Services.AddOpenApi();
builder.Services.AddControllersWithViews();
builder.Services.AddNotificationDataAccess(appSettings.ConnectionString);
builder.Services.AddNotificationServices();
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
app.MapScalarApiReference(options =>
{
options.Title = "HrynCo Notification Service";
options.Theme = ScalarTheme.DeepSpace;
});
}
app.UseStaticFiles();
app.UseHttpsRedirection();
app.MapGet("/", () => Results.Redirect("/admin/templates"));
app.MapControllers();
app.MapDefaultControllerRoute();
app.Run();