I am working on a restful service in golang using chi. I am trying to create a route as below
r.Mount("/api/dest", router.NewDestRouter(chi.NewRouter(), destSrv).InitRoutes())
func (dr *DestRouter) InitRoutes() http.Handler {
dr.router.Post("/{number}/product?version={v}", handlers.HandleProduct(dr.dest))
return dr.router
}
But I try to hit this endpoint via post man I get a 404 not found
http://localhost:8345/api/dest/1235abc/product?version=1
May I know the issue here?
As @mkopriva mentioned, simply use r.URL.Query().Get("version")
to get the query parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With