Last active
August 26, 2015 22:47
-
-
Save shamasis/07e7c0989fdffe2e0ad3 to your computer and use it in GitHub Desktop.
Modular Bootstrap for SailsJS
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
/** | |
* 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