Skip to content
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 Tweaks #1

Open
bradleypeabody opened this issue May 11, 2019 · 0 comments
Open

Router Tweaks #1

bradleypeabody opened this issue May 11, 2019 · 0 comments

Comments

@bradleypeabody
Copy link
Contributor

@calvinanderson Some notes on the router stuff you did - https://github.com/gocaveman/caveman/blob/20190509-router/router/router.go; for when you get back around to this.

  • I don't think we need a PanicHandler baked into the router. Let me know what your rationale is if you feel it's needed but from my perspective you can always wrap the chain of handlers with a panic handler at the top - the same way you would put in a Gzip middleware or similar you can do handle a panic. And even if the panic does propagate up unhandled the HTTP server will recover and log it already by default. Seems crufty to have it built into the router when you can get the same functionality using middleware.

  • I'm thinking the same applies to NotFoundHandler - although I guess it could make sense to have a default if no routes match. But I think if we have it built into the router there should be a clear rationale as to why it exists and isn't just a middleware or another type of handler.

  • As I'm sure you're already thinking with we'll need to explore how routing works with other aspects of the URL. For example matching by domain, or http/https scheme - how does this fit into picture. Or what about matching paths regardless of method. Same thing for route groups, middleware and others. More to think about on this.

Those are my initial notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant