mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 11:44:56 +00:00
40 lines
791 B
C#
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(); |