@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
43 lines (31 loc) • 1.13 kB
JavaScript
/**
* Created by Emmanuel Mahuni. MIT 2018
*/
module.exports = function (sails) {
var loader = require('../../../')(sails);
// Load policies and config from default directories
// loader.configure();
// OR if you want to set custom path :
loader.configure({
hooks: __dirname, // Path to your hook's hooks
policies: __dirname + '/api/policies', // Path to your hook's policies
config: __dirname + '/config' // Path to your hook's config
});
return {
initialize: function (next) {
// Load controllers, models & services from default directories
// loader.adapt(function (err) {
// return next(err);
// });
// OR if you want to set custom path :
loader.adapt({
controllers: __dirname + '/api/controllers', // Path to your hook's controllers
models: __dirname + '/api/models', // Path to your hook's models
helpers: __dirname + '/api/helpers', // Path to your hook's helpers
services: __dirname + '/api/services', // Path to your hook's services
}, function (err) {
return next(err);
});
}
};
};