Why?
Heroku (free) dynos are great for hosting apps and showing them off to your boss/friends or potential employer. The downside, however, is that your app will fall asleep 😴 if it doesn't receive any web traffic within a 30-minute window.
pingmydyno
solves this by pinging your server periodically so it never falls asleep.
Features
- Forever dyno pings
- Automatically retry ping on failure
Installation
npm install pingmydyno # or using yarn yarn add pingmydyno
Usage
With Express.js (ES6 module)
...;; const app = ; ... app;
With Hapi.js (commonJS)
const Hapi = ;const pingmydyno = ; const server = Hapi; async { await serverstart; ;};
With Koa.js
const Koa = ;const pingmydyno = ; const app = ;const url = processenvAPP_URL; ... app
APIs
pingmydyno(url, [Config])
url
Type: string
Required: yes
Config
Type: Object
Required: no
value | default | description | |
---|---|---|---|
pingInterval | number (milliseconds) | 1200000 | interval between the next ping (max = 25mins) |
maxRetry | number | 2 | retry times when ping fail |
onSuccess | function | ( ) => null | callback function called when a ping is successful |
onFailure | function | ( ) => null | callback function called when maxRetry ping failed |
Contributors
Thanks goes to these wonderful people (emoji key):
Kizito Akhilome 💻 | Luqman Olushi O. 🐛 💻 📖 🚧 |
This project follows the all-contributors specification. Contributions of any kind welcome!
License
This project is license under MIT