Description
Is there an option to set up a "default" route?
Right now, a lot of frontend applications use HTML5 history mode for in-app navigation. This results in URL being replaced in browser history (ex. / => hello
) without actually making a request to the new URL. This allows for frontend applications to replace their content dynamically, and use frontend only routing.
The issue is, if user reloads the page or just visits the URL by hand, there seems no way to handle that in Klein - at least I found nothing like that in source or docs - correct me if I am wrong here. As a result, user gets 404d.
If there is no such option, could we add one? If so, it should be possible to:
- Have all post-routing 404's redirected to any one configurable path
- Request with the new path should re-enter the router and match as usual
Kind of like
REQUEST /hello/world => 404? => rewrite path to / => REQUEST /
Less having hardcoded paths, not sure if there is a better way.
Activity