I used gorilla route in my gateway project. So I route all http request to a same router, then I use some extra information to decided where the request should be transmit. Firstly I store information in router's name as router.Handle(Path, c.Handler).Name(Informations).Methods(Methods...)and Informations := util.RouteConfFromStr(mux.CurrentRoute(r).GetName())
. But this looks a bit ugly. mux.Route does't provide some properties to do this. Is there a better way to store extra information without extra struct in project such as map?
如何将额外的信息存储到mux.Route?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-