Keep your apps alive with some hosting free providers, by preventing them to auto sleep after inactivity.
What is Internal Pinging?
Internal pinging is where the application, keeps itself alive usually at a certain interval, to stop them from sleeping. This is used to stop apps sleeping in free hosting services, which can allow for 24/7 hosting, given the right conditions.
Works on Heroku.com - (until free dyno hours run out)
Works on Glitch.com (10 hours at a time)
1. Install node-fetch
This package is used to send HTTP GET requests to a URL. You can use the package of your choice.
$ npm i -S node-fetch
2. Add the Script
This script will send a HTTP GET request to a Heroku app, every 5 minutes. In theory, this will keep it awake until the free dyno hours run out.
Make sure to connect the script to the bottom of your main file (e.g. app.js), and it should do the rest.
Your application should stay online for longer, or 24/7, depending on your host.
Unlike internal pinging, external pinging sends requests from the outside - from another application. For example, connecting to 2pg.xyz, from the browser, would count as an external ping. Doing this from the browser would keep a Heroku application alive, as it would prevent it from auto sleeping.
Below is an entire repository dedicated to this concept. It also works with multiple URLs, and logs when an app is kept alive.
This does not work for all free hosting providers, and could be against their TOS (terms of service).