1.0.2 • Published 8 years ago

koa-param v1.0.2

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

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