Installation
$ npm install koahub
Use with koa
var app = require(‘koa‘)();
var router = require(‘koa-router‘)();
require(‘koahub‘);
for (var key in koahub.controller){
router.use(key, koahub.controller[key]);
}
// sample as
router.use(‘/home‘, auth(‘home‘).skip({path: [/public/]}));
app.use(router.routes());
// sample as
console.log(koahub.model);
console.log(koahub.controller);
console.log(koahub.util);
app.listen(3000);
时间: 2024-12-28 16:05:08