As per this comment, it seems this is no longer possible. I’ll leave the post below for posterity’s sake.
Recently, I needed a simple way to send emails at regular times throughout the day. While the cron part of this was well documented, I felt the deployment part could use a simple, fresh approach that didn’t involve Heroku or AWS. I was instantly impressed with now, both in its simplicity and how well thought out everything was.
You have node installed and understand the basics of the command line.
npm i express cron --save
install now cli:
(update 2018–12–13: this is based on the older v1.x release of now)
npm i -g now
You can deploy your app by typing
now and following the instructions. More detailed docs are here.
Here’s the crucial part to make this work as a cron server. Since the default behavior is to autoscale from 0 to 1 instance (sleeping during periods of inactivity), we need to force it to always have one instance awake via the following command:
now scale https://my-app-replacethis.now.sh 1
That’s it! If you visit https://my-app-replacethis.now.sh/_logs (replaced with your url of course) you should see real-time logs of your cron runs.
One last thing:
Since we’re forcing it to keep each instance alive you need to manually delete old instances after new deploys using the
now rm command. You can see a list of all instances using
now ls .
I hope this was helpful, please comment if there are any errors or omissions :)