vassago/Program.cs

41 lines
1.1 KiB
C#
Raw Normal View History

2024-04-08 15:00:55 -04:00
using Microsoft.AspNetCore.Mvc.Razor;
2023-07-04 20:40:37 -04:00
using Microsoft.EntityFrameworkCore;
using vassago.Models;
2023-07-03 12:51:23 -04:00
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddSingleton<IHostedService, vassago.ConsoleService>();
builder.Services.AddDbContext<ChattingContext>();
2024-04-08 15:00:55 -04:00
builder.Services.Configure<RazorViewEngineOptions>(o => {
o.ViewLocationFormats.Clear();
o.ViewLocationFormats.Add("/WebInterface/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
o.ViewLocationFormats.Add("/WebInterface/Views/Shared/{0}" + RazorViewEngine.ViewExtension);
});
2024-06-02 18:37:04 -04:00
builder.Services.AddSwaggerGen();
2023-07-03 12:51:23 -04:00
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
2024-06-02 18:37:04 -04:00
app.UseSwagger();
app.UseSwaggerUI(c =>
{
2024-06-09 17:37:09 -04:00
c.SwaggerEndpoint("/swagger/v1/swagger.json", "api");
2024-06-02 18:37:04 -04:00
});
2024-04-08 15:00:55 -04:00
2023-07-03 12:51:23 -04:00
app.Run();