Reputation: 5230
Is it possible to group services files into subfolders under services in sails.js? This speaks about grouping controllers. How do I do the same for services?
Upvotes: 1
Views: 544
Reputation: 5871
You could try something like this
Your FooBarService.js
should just require everything inside FooBar/
/**
* FooBarService
*/
module.exports = {
foo: require('FooBar/foo.js'),
bar: require('FooBar/bar.js')
};
Or if you want to make it more sails-y, use include-all
. It is include in all sails projects, and is used everywhere in sails
/**
* FooBarService
*/
module.exports = require('include-all')({
dirname: __dirname + '/FooBar',
filter: /.+\.js$/
});
Upvotes: 1