koa-param
v1.0.2
Published
Resolve koa params
Downloads
8
Maintainers
Readme
koa-param
resolve url params
install
$ npm install koa-param
usage
import koa from 'koa';
import param from 'koa-param';
const app = koa();
app
.use(param('/users/:id', resolve))
.use(show);
function* resolve(id, next) {
this.id = id;
yield* next;
}
function* show() {
this.body = this.id;
}
// > GET /users/123
// < 123
license
MIT