Reputation: 520
I currently have a Sails.js backend-only app that, every hour:
I've found out that Azure WebJobs would make this easier, since I'd not need to manually code which realms to cover or the scheduling itself.
Is there any way to turn an Sails.js app into a WebJob? Or should I be using Waterline itself for the DB access and coding everything else manually?
Upvotes: 3
Views: 61
Reputation: 7402
I'm not familiar with Sails.js per se, but in general if you can extract your logic into a nodejs console app that you can run on your machine, then it should work as a webjob. All you would need to do is upload the full directory, that's including all the node_modules
and all the .js
files, make sure your entry point is set in a file called run.js
and you should be set.
If you want it to be triggered on a schedule, include a file called settings.job
that contains your schedule in the following format
{"schedule": "cron expression for the schedule"}
for hourly the cron expression would be 0 * * * * *
Upvotes: 1