HTTP mux for Go.
go get -u github.com/go-http-utils/mux
API documentation can be found here: https://godoc.org/github.com/go-http-utils/mux
import (
"github.com/go-http-utils/mux"
)
m := mux.New()
m.Get("/:type(a|b)/:id", mux.HandlerFunc(func(res http.ResponseWriter, req *http.Request, params map[string]string) {
res.WriteHeader(http.StatusOK)
fmt.Println(params["type"])
fmt.Println(params[":id"])
res.Write([]byte("Hello Worlkd"))
}))
http.ListenAndServe(":8080", m)