froute

Simple and powerful routing for node with expressive matching

froute

Simple and powerful routing for node with expressive matching.

npm install froute --save
var froute = require("froute");
var template = "/apple/{type}",
    bindResult = froute.bind(template, callback);
 
expect(bindResult).toBeTruthy();
expect(froute.list().length).toEqual(1);
var unbound = froute.unbind(template);
 
expect(unbound.length).toEqual(1);
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"});