Skip to content

Let The User Pass A Server Mux To SimpleServer #195

@marwan-at-work

Description

@marwan-at-work

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".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions