var router = new Router(); // Simple single-function router.on('/some/path', function () { // Do something... }); // Params in single-function router.on('/some/path/:thing', function (thing) { // Do something with 'thing'... }); // Full Object: before, load and unload events router.on('/some/path/:thing', { // Check before loading before: function (fn) { if (loggedIn) { // Pass through... fn(true); } else { // You shall not pass fn(false); } }, // Run on load load: function (thing) { // Print variable from params console.log(thing); }, // Run on leave unload: function () { console.log('Outta Here!'); } }); // Handling 404's router.on('/404', function () { // Print 'page not found' or something... // Current (pre-nav) page still appears as URL })