@vph-garage/sails-interfuser
Version:
Automizing injection of your [custom Sails.JS] hook's MVC logics (models, controllers, helpers, services, config, policies, views, and assets) from the hook's directory [presuming default structure], or specified directories, into the end-product, Sails.J
18 lines (15 loc) • 428 B
JavaScript
/**
* Emmanuel Mahuni (c) 2018 MIT
*/
const _ = require('lodash');
module.exports = {
_bindToSails: function (sails, modules, cb) {
_.each(modules, function (module) {
// Add a reference to the Sails app that loaded the module
module.sails = sails;
// Bind all methods to the module context
_.bindAll(module);
});
return cb(null, modules);
}
}