Writing middleware in #golang and how Go makes it so much fun.
Mat Ryer

When attempting to use your code, I get the following error:

“cannot use indexHandler (type func() Adapter) as type http.Handler in argument to Adapt:
 func() Adapter does not implement http.Handler (missing ServeHTTP method)”

My indexHandler looks like:

`func indexHandler() Adapter {
 return func(h http.Handler) http.Handler {
 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 fmt.Fprintln(w, “I am the final response”)

My Adapter type and Adapt function are exactly as yours. Confused about this appreciate any help.


One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.