@rtorcato/api-health-hono
v1.0.1
Published
Hono liveness/readiness probe handlers for @rtorcato/api-health.
Maintainers
Readme
@rtorcato/api-health-hono
Hono liveness/readiness probe handlers for
@rtorcato/api-health.
Install
pnpm add @rtorcato/api-health @rtorcato/api-health-honoUsage
import { createHealthRegistry } from '@rtorcato/api-health'
import { livenessHandler, readinessHandler } from '@rtorcato/api-health-hono'
const health = createHealthRegistry()
health.register('db', async () => {
await db.query('SELECT 1')
})
app.get('/healthz', livenessHandler()) // always 200
app.get('/readyz', readinessHandler(health)) // 200 all-pass, 503 any-faillivenessHandler()— always responds200 { status: 'healthy' }; runs no checks.readinessHandler(registry)— runs the registry's checks and responds200when all pass or503when any fail, with the full report as the body.
See the api-health guide for registering checks and the liveness-vs-readiness rationale.
License
MIT
