gin icon indicating copy to clipboard operation
gin copied to clipboard

can suport domain router? like github.com/gorilla/mux

Open icetech233 opened this issue 6 months ago • 4 comments

can suport domain router? like github.com/gorilla/mux

Matching Routes Routes can also be restricted to a domain or subdomain. Just define a host pattern to be matched. They can also have variables:

r := mux.NewRouter() // Only matches if domain is "www.example.com". r.Host("www.example.com") // Matches a dynamic subdomain. r.Host("{subdomain:[a-z]+}.example.com") There are several other matchers that can be added. To match path prefixes:

r.PathPrefix("/products/")

icetech233 avatar Aug 22 '24 03:08 icetech233