Created
June 16, 2016 11:24
-
-
Save ermst4r/72bd6eeb7c12028249a77bdd3d26df5b to your computer and use it in GitHub Desktop.
bootstrap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.bootstrap = function(cb) { | |
_.extend(sails.hooks.http.app.locals, sails.config.http.locals); | |
// add the lines from here | |
// bootstrapping all the cronjobs in the crontab folder | |
var schedule = require('node-schedule'); | |
sails.config.crontab.crons().forEach(function(item){ | |
schedule.scheduleJob(item.interval,sails.config.crontab[item.method]); | |
}); | |
// It's very important to trigger this callback method when you are finished | |
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap) | |
cb(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment