koa-hornbill-model

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i koa-hornbill-model

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • xiongwilee