I have this router function with mux:
func InitRouter() {
r := http.NewServeMux()
r.HandleFunc("/{id}", getWords)
log.Fatal(http.ListenAndServe(":8000", r))
}
I want that the getWords function output the value of id, for instance: if url is www.abc.com/cat, getWords will output cat if url is www.abc.com/3 getWords will output 3
I looked through out internet I didnt find explainations
Please use
github.com/gorilla/mux, and add usinggo get -u github.com/gorilla/mux:Code:
Output (on Terminal & Browser):