2.0.0 • Published 8 years ago

koa-route-map v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

koa-route-map

Koa route middleware


Install

$ npm i koa-route-map --save

Example

app.js

const koa = require('koa');
const routeMap = require('koa-route-map');

const app = koa();
app.use(routeMap('./services/'));

app.listen(3000);

services/index.js

exports.get = {
    '/': 'home.index',
    '/foo': 'home.foo',
    '/bar': 'page.bar',
};

exports.post = {
    // your config
}

services/home/index.js

exports.index = function*(){
  this.body = 'Hello';
};

exports.home = function*(){
  this.body = 'world';
};

LICENSE

MIT

2.0.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago