Fred Hors
Fred Hors

Reputation: 4136

Using Buffalo, is this the correct app.mount behaviour?

I'm using buffalo v0.13.10.

I'm trying to understand how to make it work this: https://github.com/frederikhors/buffalo-authboss-sample and I found that app.mount isn't like chi router mount (https://godoc.org/github.com/go-chi/chi#Mux.Mount).

I tried the example code here (https://gobuffalo.io/en/docs/routing#mounting-http-handler-apps):

func muxer() http.Handler {
    f := func(res http.ResponseWriter, req *http.Request) {
        fmt.Fprintf(res, "%s - %s", req.Method, req.URL.String())
    }
    mux := mux.NewRouter()
    mux.HandleFunc("/foo", f).Methods("GET")
    mux.HandleFunc("/bar", f).Methods("POST")
    mux.HandleFunc("/baz/baz", f).Methods("DELETE")
    return mux
}

a.Mount("/admin", muxer())

in my experimental app in this commit: https://github.com/frederikhors/buffalo-authboss-sample/commit/ceb4afb2151b4063ccbf4403dbe1917fa9c5c6a9

But I thought it would walk from line 42: https://github.com/frederikhors/buffalo-authboss-sample/blob/ceb4afb2151b4063ccbf4403dbe1917fa9c5c6a9/actions/app.go#L42

IT DOES NOT! Is there some problem?

Or maybe it's just me (because I'm very bad and I'm trying to learn).

Upvotes: 3

Views: 125

Answers (0)

Related Questions