sails-hook-nested-services
v0.1.0
Published
a sails hook for including nested services in the services container
Downloads
3
Readme
sails-hook-nested-services
a sails.js
hook for loading services defined in subdirectories.
Install
npm install --save sails-hook-nested-services
Purpose
By default, sails only loads top level services. This hook provides functionality for loading nested services.
// in /api/services/path/to/service.js
module.exports = {
sayHello: function() {
sails.log.silly('Hello!');
}
};
// and then in one of your controllers
module.exports = {
action: function(req, res) {
sails.services['path/to/service'].sayHello();
res.ok();
}
}
Testing
run all tests
npm test
run coverage
grunt coverage
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
Copyright (c) 2016 Chris Ludden. Licensed under the MIT license.