var model = loader([
{
root: ‘./app/model‘,
suffix: ‘.model.js‘
},
{
root: ‘./addon‘,
suffix: ‘.model.js‘,
filter: [/\w*\/model\//]
}
]);
var app = require(‘koa‘)();
var router = require(‘koa-router‘)();
var controller = loader([
{
root: ‘./app/controller‘,
suffix: ‘.controller.js‘,
prefix: ‘/‘,
}, {
root: ‘./addon‘,
suffix: ‘.controller.js‘,
prefix: ‘/addon/‘,
filter: [/\w*\/controller\//]
}
]);
for (var key in controller) {
router.use(key, controller[key].routes());
}
app.use(router.routes());
var util = loader([
{
root: ‘./app/common‘,
suffix: ‘.util.js‘
},
{
root: ‘./addon‘,
suffix: ‘.util.js‘,
filter: [/\w*\/common\//]
}
]);