I have a go/golang application equipped the gorilla toolkit. I am trying to utilize the gorilla/mux package for routing. My routes and the error message are below. Any pointers?
Routes `
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)`
I have received this error:
# 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)
There is no method Method
, you need to use Methods