ЛР 2: PostgreSQL, сессии, Redis и исследование

This commit is contained in:
Никита
2026-10-06 13:34:34 +03:00
parent 65003b6119
commit 6a8908ab99
111 changed files with 6686 additions and 38 deletions
@@ -0,0 +1,17 @@
using Messenger.Api.Data;
using Messenger.Api.Services;
namespace Messenger.Api.Endpoints;
public static class HealthEndpoints
{
public static IEndpointRouteBuilder MapHealthEndpoints(this IEndpointRouteBuilder app)
{
app.MapGet("/health/live", () => Results.Ok(new { status = "ok" }));
app.MapGet("/health/ready", async (HttpContext context, AppDatabase database) =>
await database.IsReadyAsync()
? Results.Ok(new { status = "ok" })
: ApiSupport.ApiError(context, 503, "unavailable", "База данных недоступна"));
return app;
}
}