Const
Dynamic loading and promises
router.add('/home', () => {})
.add('/home/test', () => {
//may return promise to load a new module for example and add new sub routes
router.add(/home/test/sub/, () => {});
return Promise.resolve();
});
With parameters
router.
.add(/about/, () => {
console.log('about');
})
.add(/products/(.*)/edit/(.*)/, () => {
console.log('products', arguments);
})
.add( () => {
console.log('default');
});
Generated using TypeDoc
Router instance
The router will execute all matching route methods!
so if the route is /home then both routes will execute