최초의 koahub-loader KoaHub.js - Koa.js 플랫폼 기반의 Node.js 웹 신속 개발 프레임워크 Installation<br>
<br>
$ npm install koahub-loader<br>
Use with koa<br>
<br>
// 1.model loader<br>
var model = loader([<br>
{<br>
root: './app/model',<br>
suffix: '.model.js'<br>
},<br>
{<br>
root: './addon',<br>
suffix: '.model.js',<br>
filter: [/w*/model//]<br>
}<br>
]);<br>
<br>
// 2.controller loader<br>
var app = require('koa')();<br>
var router = require('koa-router')();<br>
var controller = loader([<br>
{<br>
root: './app/controller',<br>
suffix: '.controller.js',<br>
prefix: '/',<br>
}, {<br>
root: './addon',<br>
suffix: '.controller.js',<br>
prefix: '/addon/',<br>
filter: [/w*/controller//]<br>
}<br>
]);<br>
<br>
for (var key in controller) {<br>
router.use(key, controller[key].routes());<br>
}<br>
app.use(router.routes());<br>
<br>
// 3.util loader<br>
var util = loader([<br>
{<br>
root: './app/common',<br>
suffix: '.util.js'<br>
},<br>
{<br>
root: './addon',<br>
suffix: '.util.js',<br>
filter: [/w*/common//]<br>
}<br>
]);
공식 웹사이트: http://js.koahub.com