Files
GerbilManager/GerbilManagerWebAPI/Program.cs
Gulum 4d541fe9cd ARCH-2: add Aspire AppHost + ServiceDefaults (Aspire 13.4.2)
- New projects GerbilManager.AppHost / GerbilManager.ServiceDefaults (templates)
- Added both to GerbilManager.slnx
- WebAPI references ServiceDefaults; AddServiceDefaults + MapDefaultEndpoints wired

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 23:35:15 +02:00

38 lines
882 B
C#

using GerbilManagerWebAPI.DAL;
using Microsoft.EntityFrameworkCore;
var builder = WebApplication.CreateBuilder(args);
builder.AddServiceDefaults();
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<ApplicationContext>(opts => opts.UseNpgsql(builder.Configuration.GetConnectionString("gerbilmanager")));
builder.Services.AddScoped<UnitOfWork>();
var app = builder.Build();
app.MapDefaultEndpoints();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
if (app.Environment.IsDevelopment())
{
app.UseHttpsRedirection();
}
app.UseAuthorization();
app.MapControllers();
app.Run();