koa-hornbill-model
v1.0.2
Published
KOA-hornbill绑定默认controller组件(与koa-hornbill-router配合使用)
Downloads
2
Maintainers
Readme
koa-hornbill-model
KOA-hornbill绑定默认controller组件,需要与koa-hornbill-router配合使用(use时放在koa-hornbill-router之前)
Install
$ npm install koa-hornbill-model --save
Usage
ctrl(app, options)
- app: {Object} koa instance.
- options: {Object|String->root}
- root: {String} model directory
app.js
var koa = require('koa');
var ctrl = require('..');
var router = require('koa-hornbill-router');
var app = koa();
app.use(ctrl(app, {
root: './example/model'
}));
app.use(router(app, {
root: './example/controller'
}));
app.listen(3000, function() {
console.log('Listening on 3000!');
});
Test
npm test
License
MIT