healthpoint is a lightweight Node.js utility designed to simplify the exposure of an HTTP server's health status. It provides a straightforward function that returns an HTTP request handler, allowing developers to easily integrate health check endpoints into their applications. The package, currently stable at version 1.0.0, operates on a `require`-based CommonJS module system, indicating a focus on compatibility with established Node.js environments. Its release cadence is likely slow or non-existent, given its simple, self-contained functionality. Key differentiators include its minimal API, ease of integration into existing `http` servers, and the ability to customize both the static properties exposed in the health check JSON and a dynamic asynchronous `check` function for custom health logic (e.g., database connectivity). Unlike more complex monitoring agents, healthpoint provides a focused, on-demand health status report directly from the application.
npm install healthpointVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to set up an HTTP server, integrate `healthpoint` as a middleware for the `/health` endpoint, and implement a custom asynchronous health check function.
Use `const healthpoint = require('healthpoint');` in CommonJS modules. For ESM projects, you might need to use a CommonJS wrapper, dynamic `import()` if Node.js version supports it, or a bundling tool that handles CommonJS modules.Ensure your custom `check` function always invokes the provided `cb` callback. Call `cb(null)` for a healthy state and `cb(new Error('message'))` for an unhealthy state.Ensure you are using `const healthpoint = require('healthpoint');` in a CommonJS module context. If in an ESM project, consider using dynamic `import()` if your Node.js version supports it for CJS modules, or check if a transpiler is configured to handle CJS.Verify that your asynchronous `check` logic consistently calls `cb(null)` for success or `cb(new Error('reason'))` for failure. Every code path within your `check` function must eventually invoke the callback.No dependency data recorded yet.