A simple and powerful routing for node with expressive matching
JavaScript
Latest commit 916b132 Jul 14, 2015 @leecrossley Bump jasmine
Permalink
Failed to load latest commit information.
.gitignore
.travis.yml
Gruntfile.js
README.md
froute-logo.png
froute-spec.js
froute.js
package.json

README.md

froute Build Status npm version Dependency Status

Simple and powerful routing for node with expressive matching.

froute

Getting started

npm install froute --save
var froute = require("froute");

Examples

Binding a froute template

var template = "/apple/{type}",
    bindResult = froute.bind(template, callback);

expect(bindResult).toBeTruthy();
expect(froute.list().length).toEqual(1);

Unbinding a froute template

var unbound = froute.unbind(template);

expect(unbound.length).toEqual(1);

Full example, bind and dispatch

var template = "/apple/{type}/size/{size}",
    resultParams;

var bindResult = froute.bind(template, function(params) {
    resultParams = params;
});

var dispatchResult = froute.dispatch("/apple/gala/size/large");

expect(bindResult).toBeTruthy();
expect(dispatchResult).toBeTruthy();
expect(froute.list().length).toEqual(1);
expect(resultParams).toEqual({type:"gala",size:"large"});