1
如何將中間件應用到Go Gorilla Toolkit mux子路由器?與Golang一起使用中間件Gorilla mux子路由器
我有以下代碼:
router := mux.NewRouter().StrictSlash(true)
apiRouter := router.PathPrefix("/api/").Subrouter()
apiRouter.Methods(http.MethodGet).
Path("/api/path/to/handler").Handler(handleAPICall)
我想申請,檢查安全性令牌的中間件處理,但僅限於那些與/api
啓動路徑。