I’m finishing my meteor App and there is one thing I still don’t know how to implement.
I have a server method that should run every X minutes, i wonder if there is a way to set up a url that calls to this method and afterwards configure a cron calling to this url every X minutes.
As far as I know, yes the code should run! But be warned, anyone will be able to access that route, so some kind of auth should be done on the server, co only the cron can run it
Well at the end it was pretty easy using iron router. I share the code in case anyone step upon this post in the future:
Router.route('/closePromos',function(){
//server side code here
...
var res = this.reponse;
res.end('Your server has executed the code');
}, {where : 'server' });
Then you just have to set up a cron with a curl to the /closePromos route. It is important to do the reponse.end()