buildout full stack functionality

This commit is contained in:
KS Jannette
2026-07-30 18:55:28 -04:00
parent f5ded658b8
commit 04a2910af5
22 changed files with 3759 additions and 3 deletions

View File

@@ -1,13 +1,17 @@
using System.Text.Json;
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.AddCors();
@@ -32,6 +36,19 @@ app.UseHttpsRedirection();
app.UseAuthorization();
app.MapHealthChecks("/health", new HealthCheckOptions
{
ResponseWriter = async (context, report) =>
{
context.Response.ContentType = "application/json";
var payload = JsonSerializer.Serialize(new
{
status = report.Status == HealthStatus.Healthy ? "healthy" : "unhealthy",
});
await context.Response.WriteAsync(payload);
},
});
app.MapControllers();
app.Run();