@rtorcato/api-health v1.0.0
Interfaces
CheckResult
Defined in: index.ts:9
Properties
status
status:
HealthStatus
Defined in: index.ts:10
error?
optionalerror?:string
Defined in: index.ts:12
Present only when the check threw/rejected.
HealthReport
Defined in: index.ts:15
Properties
status
status:
HealthStatus
Defined in: index.ts:16
checks
checks:
Record<string,CheckResult>
Defined in: index.ts:17
HealthRegistry
Defined in: index.ts:20
Properties
register
register: (
name,check) =>void
Defined in: index.ts:22
Register a readiness check by name. Re-registering a name replaces it.
Parameters
name
string
check
Returns
void
run
run: () =>
Promise<HealthReport>
Defined in: index.ts:24
Run every registered check concurrently and build a report.
Returns
Promise<HealthReport>
Type Aliases
HealthStatus
HealthStatus =
"healthy"|"unhealthy"
Defined in: index.ts:1
HealthCheck
HealthCheck = () =>
void|Promise<void>
Defined in: index.ts:7
A readiness check. Return (or resolve) normally to report healthy; throw or reject to report unhealthy — the thrown message is surfaced in the report.
Returns
void | Promise<void>
Functions
createHealthRegistry()
createHealthRegistry():
HealthRegistry
Defined in: index.ts:35
Create a registry of readiness checks (DB pings, broker connections, …).
Framework-agnostic — mount it via @rtorcato/api-health-express or
@rtorcato/api-health-hono, or call run() yourself. Liveness needs no
registry: it just reports the process is up, so the adapters expose a
ready-made liveness handler separately.