aquaduck

0.0.4 • Public • Published

aquaduck

What

Aquaduck aims to duplicate/replace the routing functionality in beeline but in a standalone module.

Why

Sometimes I want beeline's routing, but not all it's serving stuff.

Usage

var aquaduck = require('aquaduck');

At the moment aquaduck only supports one kind of route matching:

var routes = {
        'foo.com/`thing`/`stuff`': function(tokens){
            tokens.thing === 'majigger';
            tokens.stuff === 'whatsits';
        }
    };

var matchedRoute = aquaduck(routes, 'foo.com/majigger/whatsits');

matchedRoute will contain .value .tokens, and .route, so you can use it to run the function:

matchedRoute.value(matchedRoute.tokens);

Other beeline-like routing will be added in the future.

Why is aquaduct spelt incorrectly.

aquaduct is taken on npm, aquaduck is funny.

Readme

Keywords

none

Package Sidebar

Install

npm i aquaduck

Weekly Downloads

2

Version

0.0.4

License

ISC

Last publish

Collaborators

  • korynunn