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

Let The User Pass A Server Mux To SimpleServer #195

Open
marwan-at-work opened this issue Feb 11, 2019 · 1 comment
Open

Let The User Pass A Server Mux To SimpleServer #195

marwan-at-work opened this issue Feb 11, 2019 · 1 comment

Comments

@marwan-at-work
Copy link
Contributor

The first win is that this would solve this issue: #173

The second win, is that you can use Gorilla features directly such as StrictSlash, and SkipClean etc.

Thirdly, Server Muxes such as Gorilla have evolved pretty well to:

  1. Let you do a lot more than it used to: you can now have middleware on handlers, the entire mux, use sub routers, multiple sub routers, etc.
  2. Be a well known standard across companies and open source projects

This would clean up a lot of the simple server code as it will mainly do the uplifting of running a production server: graceful shutdowns, tracing, metrics, etc.

The way I propose we do this, if wanted, is that a user can register a handler instead of a Service, but eventually removing the Service interface in a major tag release.

That said, I do like the map[string]map[string]http.HandlerFunc data structure as it looks pretty concise and readable. However, issue 173 will not be solved until if/when generics implement an "ordered map".

@jprobinson
Copy link
Contributor

jprobinson commented Feb 11, 2019

The plus for embedding the router is that it takes another decision out of the way for developers. One way of maintaining that would be to go the RouterOption route like the kit server. https://godoc.org/github.com/NYTimes/gizmo/server/kit#RouterOption It'd just require use to make another Option or two for StrictSlash and the like.

That being said, I'm not against trying out some other method, but I would like to keep some kind of data structure like we do have now.

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 a pull request may close this issue.

2 participants