vassago/Program.cs
Adam R Grey c5f9ae2c6b
All checks were successful
gitea/vassago/pipeline/head This commit looks good
collapse users - extracted for LinkMe and my own self-registration
2024-01-05 22:12:57 -05:00

28 lines
793 B
C#

using Microsoft.EntityFrameworkCore;
using vassago.Models;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
builder.Services.AddSingleton<IHostedService, vassago.ConsoleService>();
builder.Services.AddDbContext<ChattingContext>(options =>
options.UseNpgsql(builder.Configuration.GetConnectionString("ChattingContext") ),ServiceLifetime.Transient);
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();