Skip to content

KOA-grace绑定默认controller组件,需要与koa-grace-router配合使用(use时放在koa-grace-router之前)

Notifications You must be signed in to change notification settings

koa-grace/koa-grace-model

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-grace-model

KOA-grace绑定默认controller组件,需要与koa-grace-router配合使用(use时放在koa-grace-router之前)

Install

$ npm install koa-grace-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-grace-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

About

KOA-grace绑定默认controller组件,需要与koa-grace-router配合使用(use时放在koa-grace-router之前)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published