1 回答
TA贡献1829条经验 获得超6个赞
我们必须使用正则表达式在弯曲的括号内进行路径变量检查,因此正确的路由表应该看起来像^
router.HandleFunc(baseUri + "/function/", webApiContext.GetAllFunctions).Methods("GET")
router.HandleFunc(baseUri + "/function/find/", webApiContext.FindFunctions).Methods("GET").Queries("query", "{query}")
router.HandleFunc(baseUri + "/function/{id:[0-9]+}/", webApiContext.GetFunctionById).Methods("GET")
router.HandleFunc(baseUri + "/function/{id:[0-9]+}/body/", webApiContext.GetFunctionBodyById).Methods("GET")
router.HandleFunc(baseUri + "/function/", webApiContext.CreateFunction).Methods("POST")
router.HandleFunc(baseUri + "/function/{id:[0-9]+}/", webApiContext.UpdateFunction).Methods("PUT")
router.HandleFunc(baseUri + "/function/{id:[0-9]+}/", webApiContext.DeleteFunction).Methods("DELETE")
- 1 回答
- 0 关注
- 137 浏览
添加回答
举报