Nosferatu's Pace Maker

    siren-mount

    1.0.0 • Public • Published

    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

    Install

    npm i siren-mount

    DownloadsWeekly Downloads

    3

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • texvnars