Healthcheck
Nuxt logger for doing amazing things.
Simply application healthcheck endpoints.
Install the module to your Nuxt application with one command:
npx nuxi module add @nasontech/nuxt-healthcheck
That's it! You can now use defineHealthcheck
in your Nuxt app ✨
Files placed in server/healthchecks
will be registered automatically using the filename as the healthcheck name.
Example server/healthchecks/database.ts
export default defineHealthcheck((_event) => {
const data = {
usedConnections: 0,
maxConnections: 10,
unusedConnections: 5,
}
const isHealthy = data.usedConnections < data.maxConnections
return {
data,
isHealthy,
}
})
Querying /readyz?verbose
will return
{
"database": {
"isHealthy": true,
"data": {
"usedConnections": 0,
"maxConnections": 10,
"unusedConnections": 5
}
}
}
Local development
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release