for _, adapter := range adapters { h = adapter(h) } return h } func main() { l := log.New(os.Stdout, "server:", log.Lshortfile) db, _ := mgo.Dial("localhost") defer db.Close() http.Handle("/", Adapt(http.HandlerFunc(index), Mongo(db), Logging(l), Cors)) http.ListenAndServe("localhost:8080", nil) } func index(rw http.ResponseWriter, req *http.Request) { fmt.Fprint(rw, "Hello world") } adapter.go