本文整理匯總了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"))
}