mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-09-30 18:13:14 +00:00
33 lines
916 B
C#
33 lines
916 B
C#
|
|
using Microsoft.EntityFrameworkCore;
|
||
|
|
using ProposalSystem.Infrastructure.Data;
|
||
|
|
|
||
|
|
var builder = WebApplication.CreateBuilder(args);
|
||
|
|
|
||
|
|
builder.Services.AddControllers();
|
||
|
|
builder.Services.AddEndpointsApiExplorer();
|
||
|
|
|
||
|
|
builder.Services.AddDbContext<ProposalDbContext>(options =>
|
||
|
|
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
|
||
|
|
|
||
|
|
builder.Services.AddAuthentication("Bearer")
|
||
|
|
.AddJwtBearer(options =>
|
||
|
|
{
|
||
|
|
options.Authority = builder.Configuration["Auth:Authority"];
|
||
|
|
options.Audience = builder.Configuration["Auth:Audience"];
|
||
|
|
});
|
||
|
|
|
||
|
|
builder.Services.AddAuthorization();
|
||
|
|
builder.Services.AddHealthChecks()
|
||
|
|
.AddDbContextCheck<ProposalDbContext>();
|
||
|
|
|
||
|
|
builder.Services.AddAWSLambdaHosting(LambdaEventSource.HttpApi);
|
||
|
|
|
||
|
|
var app = builder.Build();
|
||
|
|
|
||
|
|
app.UseAuthentication();
|
||
|
|
app.UseAuthorization();
|
||
|
|
app.MapControllers();
|
||
|
|
app.MapHealthChecks("/api/health");
|
||
|
|
|
||
|
|
app.Run();
|