NAME

PAGI::App::Healthcheck - Health check endpoint app

SYNOPSIS

use PAGI::App::Healthcheck;

my $app = PAGI::App::Healthcheck->new(
    checks => {
        database => sub { check_db() },
    },
)->to_app;

DESCRIPTION

Returns JSON health status with optional custom checks. Returns 200 for healthy, 503 for unhealthy.

OPTIONS

  • checks - Hashref of name => coderef check functions

  • version - Application version to include in response

RESPONSE FORMAT

{
    "status": "ok",
    "timestamp": 1234567890,
    "uptime": 3600,
    "version": "1.0.0",
    "checks": {
        "database": { "status": "ok" },
        "cache": { "status": "error", "message": "Connection refused" }
    }
}