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

issues/134: Add a router/muxer with a bit more functionality #140

Merged
merged 43 commits into from
Sep 27, 2022
Merged

Conversation

komuw
Copy link
Owner

@komuw komuw commented Sep 27, 2022

What:

  • Add a router/muxer with a bit more functionality

Why:

How:

  • The muxer/router added is mainly taken/based from matryer/way[1]
  • The main differences are:
    • this router does not support ... suffix in uri paths
    • this router always adds a / prefix and suffix.
    • this router does have the ability to detect conflicts[2]
    • this router does not use * as a way to specify that a handler handles all http methods.
    • this router does not admit/reject requests based on http methods.It should be up to the handler itself to reject/admit a request based on http method.

ref:

  1. https://github.com/matryer/way
  2. https://www.alexedwards.net/blog/which-go-router-should-i-use

server/newmux/mux.go Outdated Show resolved Hide resolved
// NewRouter makes a new Router.
func NewRouter() *Router {
return &Router{
// TODO: add ability for someone to pass in a notFound handler.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

server/newmux/mux.go Outdated Show resolved Hide resolved
…st based on a http method.

It should be up to the handler itself to reject/admit a request based on http method
@komuw komuw marked this pull request as ready for review September 27, 2022 12:58
@komuw komuw merged commit 1356a5d into main Sep 27, 2022
@komuw komuw deleted the issues/134 branch September 27, 2022 13:57
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

Successfully merging this pull request may close these issues.

create router
1 participant