Add health probe endpoint

This commit is contained in:
Beau Findlay
2026-01-31 22:03:27 +00:00
parent 3eb1798972
commit eae66518c8

View File

@@ -2,16 +2,19 @@ using BlazorApp.Components;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorComponents();
var app = builder.Build();
// Configure the HTTP request pipeline.
app.MapGet("/health", () => Results.Ok(new
{
status = "healthy",
timestamp = DateTime.UtcNow
}));
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error", true);
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}