route-trie v0.1.0
A trie-based URL router.
** It is a different implementation from routington**
route-trie is a trie-based URL router.
Its goal is only to define and match URLs.
It does not handle methods, headers, controllers, views, etc., in anyway.
It is faster than traditional, linear, regular expression-matching routers, although insignficantly,
and scales with the number of routes.
The purpose of this router isn't for performance, but to bring more structure to URL routing.
The intention is for you to build a framework on top either in node.js or in the browser.
Implementations:
Browser Support
IE9+
Demo
Installation
Node.js:
npm install route-trie
Bower:
bower install route-trie
API
var Trie = require('route-trie');
Trie([flagI])
var trie = new Trie();
var trie = new Trie(true);
Trie.prototype.define(pattern)
var node = trie.define('/:type/:id([a-z0-9]{6}');
Trie.prototype.match(path)
var match2 = trie.mathc('/post');
var match = trie.mathc('/post/abc123');