
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@relab/fastify-health-check
Advanced tools
Fastify plugin that provides health probes and exposes corresponding endpoints.
Fastify plugin that provides health probes and exposes corresponding endpoints.
npm install --save @relab/fastify-health-check
npm add @relab/fastify-health-check
import { HealthCheck, ComponentsHealthCheck, HealthChecks } from '@relab/fastify-health-check'
import { handleShutdown, onShutdown } from '@relab/graceful-shutdown'
// Just generic health check
// Returns HTTP 200 unless you throw HealthCheckError
const startup: HealthCheck = {
url: 'startup',
check: () => {
// check your resources if needed
},
}
// Health check that allows to track multiple component
// Use probe.setHealthy('<component name>') to make it healthy
// Health check returns HTTP once all components are healthy
export const ready = new ComponentsHealthCheck('ready', ['http'])
const live: HealthCheck = {
url: 'live',
check: () => {
// check your resources if needed
if (/* something wrong */) {
throw new HealthCheckError({ database: 'Unhealthy' })
}
return { uptime: process.uptime() }
},
}
const fastify = Fastify({
logger: true,
})
// Now your probes available at /health/startup, /health/ready and /health/live
.register(HealthChecks, {
prefix: 'health',
probes: [startup, ready, live],
})
fastify.addHook('onListen', done => {
ready.setHealthy('http')
done()
})
onShutdown(async () => {
ready.setUnhealthy('http')
})
fastify.listen({ port: 3000 })
handleShutdown()
Released under MIT by Sergey Zwezdin.
FAQs
Fastify plugin that provides health probes and exposes corresponding endpoints.
We found that @relab/fastify-health-check demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.