fleshout backend

This commit is contained in:
KS Jannette
2026-08-03 04:23:32 -04:00
parent a00282b1e6
commit 092ef17439
19 changed files with 500 additions and 52 deletions

View File

@@ -1,42 +1,35 @@
using System.Text.Json;
using Backend.Data;
using Backend.Gateway;
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
// using Backend.Data
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddHealthChecks();
builder.Services.AddProblemDetails();
builder.Services.AddCors();
//builder.Services.AddDbContext<UserContext>(options =>
// options.UseSqlite(builder.Configuration["ConnectionStrings:UserConnection"])
//);
//builder.Services.AddScoped<IBowlingLeagueRepository, EFBowlingLeagueRepository>();
builder.Services.AddApiGateway(builder.Configuration);
builder.Services.AddPersistence(builder.Configuration);
var app = builder.Build();
// Configure the HTTP request pipeline.
app.UseExceptionHandler();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseCors(p => p.WithOrigins("http://localhost:3000"));
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseApiGateway();
app.MapHealthChecks("/health", new HealthCheckOptions
app.MapHealthChecks(ApiRoutes.Health, new HealthCheckOptions
{
ResponseWriter = async (context, report) =>
{
@@ -51,4 +44,4 @@ app.MapHealthChecks("/health", new HealthCheckOptions
app.MapControllers();
app.Run();
app.Run();