Skip to content
forked from koajs/mount

Mount other koa applications or middleware to a given pathname pattern.

Notifications You must be signed in to change notification settings

TerenceZ/siren-mount

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

An mounting middleware for koa

Build Status

siren-mount is modified from the koa-mount by:

Installation

npm install --save siren-mount

Usage

The usage is the same as koa-mount, except:

Regular Expression Path

You can use regular expression as prefix:

var app = koa();
var router = koa();

app.use(mount(/\/([^\/]+)\/?/i, function *() {
  // Matches /abc, /abc/, /abcdadc/dsd
}));

Parameter Access

You can use ctx.params to access the URL parameters:

var app = koa();
var router = koa();

app.use('/:id', function *() {
  console.log(this.params.id);
}));

License

MIT

About

Mount other koa applications or middleware to a given pathname pattern.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%