Files
Govor/Govor.API/Program.cs
T
2025-06-16 22:31:45 +07:00

40 lines
791 B
C#

using Govor.Data;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
// Add services
builder.Services.AddSignalR();
builder.Services.AddControllers();
builder.Services.AddDbContext<GovorDbContext>(
options =>
{
options.UseNpgsql(builder.Configuration.GetConnectionString(nameof(GovorDbContext)));
}
);
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddOpenApi();
builder.Services.AddAuthorization();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();