In an HTTP server written in go, I use gorilla/mux for routing,
I want to use http.TimeoutHandler
(and/or other "middleware") but I can't understand where I can fit them.
To make it clear:
- I create a new Router by
gorillaMux := mux.NewRouter()
- add my routes by calls like
gorillaMux.HandleFunc("/", rootHandler)
- I create the server by
server := &http.Server{Addr:":1234"}
andserver.ListenAndServe()
Where can I insert the http.TimeoutHandler
or any other middleware for that matter?