UNPKG

sails-util-micro-apps

Version:

Load micro-APPs (models, controllers, helpers, services, config and policies) from a hook's directory structure or specified directories and inject them into the main Sails app.

18 lines (15 loc) 428 B
/** * 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); } }