Skip to content

purposeindustries/koa-param

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published