-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router should have default 404 handler #172
Comments
The router does support the match-all syntax which can be added as the last entry to catch all routes that do not match. It is how itty-router is implemented. Would that be sufficient in this case.
I personally think that there should be no default route handling because there are cases where I would want to use a router to be triggered only on specific routes. |
I suppose that would be sufficient. I simply found it surprising that the router wasn't catching unknown routes, but if we give the user a good way to do this (and display it prominently in the docs, that is probably good enough. |
I think there are two ways of approaching this:
Initially, I thought option 2 would be the best way to go. Option 2 would be especially useful for developers using multiple languages to craft Spin applications. On the flip side, option 1 would smoothen the adoption for JS developers, because they expect the router to behave in a certain way. |
When a request goes through the router for which there is no route defined, a very cryptic message is thrown. We should at least provide some sort of default handling of an unrecognized request.
The text was updated successfully, but these errors were encountered: