Skip to content

zhangking/koar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa_r

a simple route middleware for koa.

Installation

npm install koa_r

Example

Contrived resource-oriented example:

var r = require('./');
var koa = require('koa');
var app = koa();


app.use(r.create({
  folder:'./Controllers/',
  before:function*(){},
  after:function*(){},
  error:function*(){this.body = 'error'},
  map:{
    '/user/:name':'/user/show'
  }
}));

app.use(function*(){
  console.log(1);
});


app.listen(3000);
console.log('listening on port 3000');

License

MIT

About

a simple route middleware for koa.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published