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