Avoid heroku server from sleeping
<p>I got a website hosted on a <a href="http://heroku.com" rel="noreferrer">Heroku</a> server (<em>i'm a new to Heroku btw</em>), and as it's under the free package, it sleeps after <strong>30m of inactivity</strong>, and to put it in action again when a user hits it, it takes around 7 secs to <code>npm run start</code> successfully.</p>

<p>I'm thinking of run a nodejs job or something that open the website every 29m so that the server never sleeps, initially, I got something like this:</p>

<pre><code>(function wakeup() {
  require('open')('https://mywebsite.herokuapp.com', (err) =&gt; {
    if (err) throw err;
    console.log('Woke up!');
    setTimeout(wakeup, 1740000); //29m
  });
})()
</code></pre>

<p><em>N.B.: That just opens it in a browser, but not handling closing it.</em></p>

<ul>
<li>First, is it legal to do this workaround?</li>
<li>Second, if yes, what's the best approach to implement this?</li>
</ul>