keepalive-server
v1.0.6
Published
Simple keepalive ping library for Node.js to periodically hit a given URL
Maintainers
Readme
Here’s your README.md cleaned up so it’s concise, clear, and properly formatted:
keepalive-server
Simple Node.js library to ping a URL at a fixed interval.
Installation
npm i keepalive-serverUsage
ESM
import { ping } from 'keepalive-server';
ping(60000, 'https://your-url.com'); // ping every 60 secondsCommonJS (with dynamic import for ESM support)
(async () => {
const { ping } = await import('keepalive-server');
ping(60000, 'https://your-url.com');
})();API
ping(intervalMs, url, timeoutMs?)
- intervalMs — interval in milliseconds (e.g.,
60000for 1 min) - url — target URL to ping
- timeoutMs (optional) — per-request timeout in milliseconds (default:
10000)
Notes
- This library is ESM-only. In CommonJS projects, use the dynamic
import()pattern above. - Recommended to ping a lightweight
/healthendpoint instead of the full site.
For further issues, you can ping me on @codeguyakash
