本文整理汇总了Golang中github.com/gorilla/mux.Route.Subrouter方法的典型用法代码示例。如果您正苦于以下问题:Golang Route.Subrouter方法的具体用法?Golang Route.Subrouter怎么用?Golang Route.Subrouter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/gorilla/mux.Route
的用法示例。
在下文中一共展示了Route.Subrouter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: BuildEndpoint
func BuildEndpoint(route *mux.Route, modelName string, jsEngine *js.JSEngine, db *leveldb.DB) {
router := route.Subrouter()
router.StrictSlash(true)
router.HandleFunc("/{id:.+}", buildGetOneHandler(modelName, jsEngine)).Methods("GET")
router.HandleFunc("/{id:.+}", buildPutOneHandler(modelName, jsEngine)).Methods("PUT")
router.HandleFunc("/{id:.+}", buildDeleteOneHandler(modelName, jsEngine)).Methods("DELETE")
router.HandleFunc("/", buildGetAllHandler(modelName, db)).Methods("GET")
router.HandleFunc("/", buildPostHandler(modelName, jsEngine)).Methods("POST")
}
示例2: InitEndpointsHandlers
// Init - Initialize application
func InitEndpointsHandlers(globals *config.Globals, parentRotuer *mux.Route) {
router := parentRotuer.Subrouter()
router.HandleFunc("/", SecurityContextHandler(endpointsPageHandler, globals, "ADMIN"))
router.HandleFunc("/{name}", SecurityContextHandler(endpointPageHandler, globals, "ADMIN"))
router.HandleFunc("/{name}/{action}", SecurityContextHandler(endpointActionPageHandler, globals, "ADMIN"))
}
示例3: InitUsersHandlers
// Init - Initialize application
func InitUsersHandlers(globals *config.Globals, parentRotuer *mux.Route) {
router := parentRotuer.Subrouter()
router.HandleFunc("/{login}", SecurityContextHandler(userPageHandler, globals, "ADMIN"))
router.HandleFunc("/", SecurityContextHandler(usersPageHandler, globals, "ADMIN"))
}
示例4: InitCertsHandlers
// Init - Initialize application
func InitCertsHandlers(globals *config.Globals, parentRotuer *mux.Route) {
router := parentRotuer.Subrouter()
router.HandleFunc("/", SecurityContextHandler(certsPageHandler, globals, "ADMIN"))
router.HandleFunc("/upload", SecurityContextHandler(certUploadPageHandler, globals, "ADMIN")).Methods("POST")
router.HandleFunc("/delete", SecurityContextHandler(certDeletePageHandler, globals, "ADMIN"))
}
示例5: InitStatsHandlers
// Init - Initialize application
func InitStatsHandlers(globals *config.Globals, parentRotuer *mux.Route) {
router := parentRotuer.Subrouter()
router.HandleFunc("/", SecurityContextHandler(statsPageHandler, globals, ""))
router.HandleFunc("/server", ContextHandler(statsServerPageHandler, globals))
router.HandleFunc("/admin", ContextHandler(statsAdminPageHandler, globals))
}
示例6: InitSettingsHandlers
// Init - Initialize application
func InitSettingsHandlers(globals *config.Globals, parentRotuer *mux.Route) {
router := parentRotuer.Subrouter()
router.HandleFunc("/", SecurityContextHandler(settingsPageHandler, globals, "ADMIN"))
router.HandleFunc("/setdebug", SecurityContextHandler(setdebugPageHandler, globals, "ADMIN"))
router.HandleFunc("/confreload", SecurityContextHandler(confReloadPageHandler, globals, "ADMIN"))
}