route
v0.2.5
Published
Simple routing library
Downloads
2,134
Maintainers
Readme
route
Basic routing:
function foo(year, month, day, id) {
// ...
};
function bar(first, middle, last) {
// ...
};
function baz(optional) {
// ...
};
$.route.add({
'foo/:year/:month/:day/:id': foo, // Regular arguments capture a single path part
'bar/:first/*middle/:middle': bar // Splat arguments capture any number of path parts
'baz[/:optional]': baz // Brackets indicate optional path components
});
$.route.run(document.location.pathname);
Usage with Ender
After you install Ender, include route
in your package:
ender add route