1.0.3 • Published 7 years ago

toy-koa-router v1.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

toy koa router

npm

Installation

$ npm install toy-koa-router

Example

const Koa = require('koa');
const KoaRouter = require('toy-koa-router');

const app = new Koa();
const router = new KoaRouter();

router.get('/abc/:id',
    async (ctx, next) => {
        console.log(1);
        await next();
        console.log(3);
    },
    async (ctx, next) => {
        console.log(2);
        await next();
        console.log(4);
    }
);

app.use(router.routes());

app.use((ctx, next) => {
    console.log(5);
    ctx.body = 'nice';
});

app.listen(3000);

License

MIT

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago