Skip to content

Instantly share code, notes, and snippets.

@shamasis
Last active August 26, 2015 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamasis/07e7c0989fdffe2e0ad3 to your computer and use it in GitHub Desktop.
Save shamasis/07e7c0989fdffe2e0ad3 to your computer and use it in GitHub Desktop.
Modular Bootstrap for SailsJS
/**
* Bootstrap
* (sails.config.bootstrap)
*
* An asynchronous bootstrap function that runs before your
* Sails app gets lifted.
*/
module.exports.bootstrap = function (callback) {
// load all modules *Bootstrap.js in bootstrap directory
// and execute async
async.eachSeries(_.values(require('include-all')({
dirname: __dirname + '/../bootstrap',
filter : /(.+Bootstrap)\.js$/,
excludeDirs : /^\.(git|svn)$/,
optional: true
})), function (bootmodule, callback) {
_.isFunction(bootmodule) &&
(bootmodule(callback), true) || callback();
}, callback);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment