我有一个配备大猩猩工具包的go / golang应用程序。我正在尝试使用gorilla / mux包进行路由。我的路线和错误信息如下。有什么指针吗?
路线 `
r := mux.NewRouter()
r.HandleFunc("/", landing)
r.HandleFunc("/contact", contact)
r.HandleFunc("/faq", faq)
r.HandleFunc("/register", accountsC.New).Method("GET")
r.HandleFunc("/register", accountsC.Create).Method("POST")
http.ListenAndServe(":8080", r)`
我收到了这个错误:
# command-line-arguments
./main.go:27: r.HandleFunc("/register", accountsC.New).Method undefined
(type *mux.Route has no field or method Method)
./main.go:28: r.HandleFunc("/register", accountsC.Create).Method undefined
(type *mux.Route has no field or method Method)