To define your routes you need to invoke either the Router.add() or even shorter route() function. The required arguments are pretty simple.
For every route you need to pass a pair of two arguments:
route(
'< hash 1 >', function() {
// do something
},
'< hash 2 >', function() {
// do something
}
);
Optionally, you can match params using either of the following formats:
route(
'get/:id', function(id) {
// do something
}
);
These are the routes defined for this demo page.
The Javascript library router.js is written by Paul Engel.