negroni

    0熱度

    2回答

    我的基本main設置: muxRouter := mux.NewRouter() v1Router.Router(muxRouter.PathPrefix("/v1").Subrouter()) http.Handle("/", muxRouter) n := negroni.Classic() n.Use(negroni.HandlerFunc(apiRouter.Middlew

    0熱度

    1回答

    我的golang應用程序的關鍵組件使用移植的GraphicsMagick library,這需要使用-tags gm構建庫。 例如: go build -tags gm 不過,我建設基礎上,negroni framework Web服務,並與gin運行它,讓我用命令gin運行應用程序。我找不到任何將構建標籤傳遞給杜松子酒的方法。有什麼建議麼?

    3熱度

    1回答

    對我的應用程序的每個請求都應該使用一些中間件。使用內格羅尼文檔我已經實現了它,像這樣: func MyMiddleware(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { // do some stuff before next(rw, r) } 和其他地方使用: n.Use(negron

    0熱度

    1回答

    因此,我是Go新手,嘗試構建簡單的Web服務器。我遇到的一個問題是我想用靜態URL(通過瀏覽器啓用長緩存)提供靜態文件。例如,我可能有這個網址: /static/876dsf5g87s6df5gs876df5g/application.js 但我想爲位於文件: /build/application.js 我怎麼會去這與圍棋/內格羅尼/大猩猩複用器?

    0熱度

    1回答

    所以我想設置我的路由器,爲/users和/users/{userId}迴應,所以我嘗試此代碼: usersRouter := router.PathPrefix("/users").Subrouter() usersRouter.HandleFunc("", users.GetUsersRoute).Methods("GET") usersRouter.HandleFunc("/{userId

    -1熱度

    1回答

    我有以下代碼: r := mux.NewRouter() r.Handle("/", http.FileServer(http.Dir("./frontend/build/"))) r.Handle("/static", http.FileServer(http.Dir("./frontend/build/static/"))) r.PathPrefix("/api").Handler(au

    0熱度

    1回答

    我想只在一些路由上添加一箇中間件。我寫了這個代碼: func main() { router := mux.NewRouter().StrictSlash(false) admin_subrouter := router.PathPrefix("/admin").Subrouter() //handlers.CombinedLoggingHandler comes