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>();
|
2023-07-04 20:40:37 -04:00
|
|
|
builder.Services.AddDbContext<ChattingContext>(options =>
|
2024-01-10 21:21:31 -05:00
|
|
|
options.UseNpgsql(builder.Configuration.GetConnectionString("ChattingContext") ));
|
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?}");
|
|
|
|
|
|
|
|
app.Run();
|