Skip to content

Sub router #154

@gsquire

Description

@gsquire

I searched through the issues but couldn't find anything for sub routers with paths. I don't care about subdomains.

My use case is for API versioning. Here is a snippet from the Gorilla mux:

r := mux.NewRouter()
s := r.PathPrefix("/products").Subrouter()
// "/products/"
s.HandleFunc("/", ProductsHandler)
// "/products/{key}/"
s.HandleFunc("/{key}/", ProductHandler)
// "/products/{key}/details"
s.HandleFunc("/{key}/details", ProductDetailsHandler)

It would be sweet to have a sub router for each version prefix. Is this currently possible or something you could add?

Forgive me if I missed something in the README or documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions