@ikeshav26/keep-awake
v1.0.3
Published
Keep your free tier servers awake via cron-based pinging.
Maintainers
Readme
Keep-Awake
A lightweight, strictly-typed Node package to keep your free-tier servers (Render, Heroku, Railway, etc.) awake using a lightweight cron job.
Installation
npm i @ikeshav26/keep-awakeBasic Usage
Import the package and pass your server API URL and interval (in minutes). The package will ping the endpoint at that interval to prevent the server from falling asleep from inactivity.
import { keepAwake } from 'keep-awake';
import express from 'express';
const app = express();
app.get('/ping', (req, res) => {
res.status(200).send('Server is awake');
});
app.listen(3000, () => {
console.log("Server listening on port 3000");
// Start pinging your server every 14 minutes
keepAwake({
url: "https://my-awesome-app.onrender.com/ping",
interval: 14 // Interval in minutes
});
});Warning
Please use this package responsibly and ensure it complies with your hosting provider's Terms of Service for free-tier products.
