Search code examples
javascriptnode.jsmeteorheroku

Running a JavaScript file in Meteor JS environment


How can I run a JavaScript file on the server side in meteor JS environment ?

Some context to what I am trying to do: I want to insert a document into the mongo database in an automated way. (I know how to insert documents in meteor but that is event driven like clicking a button etc...). I am using Heroku to deploy my app and I want to insert some data using the Heroku scheduler at a specified interval.

Heroku scheduler can run a file (eg: node hello.js) at a specified interval. Should I be writing a file in nodejs to what I am trying to achieve or is there a way to do in the meteor framework.


Solution

  • I would suggest trying percolate:synced-cron - a cron system for Meteor that will also allow you to scale and sync the cron with multiple servers as you grow.