Open ghost opened 8 years ago
you can config router with '/:def' tag like {'/:def': defaultPage}
Currently I am doing:
const router = new director.http.Router({
'/pws/GetMaterial': {
get: getMaterial,
},
'/pws/AddEvent2': {
post: genericPost,
},
});
How would I use '/:def' with this approach, in other words I tried you suggestion and it did not work in the way I am initializing a router.
A catch all that worked for me:
Router(self.routes())
.configure({
on: ns.view.table['all routes']
})
.init('/');
… and later in my routing table:
'/?((\w|.)*)': ns.view.table['catch all'], // Catches all non-specified routes.
'/': ns.view.table['splash screen']
Maybe I have missed the obvious, but how can I implement a catch all route? I currently have a number of routes, but I want that for any url that does not match one of my routes to be caught and sent to a default page.