本文整理汇总了Golang中github.com/dimfeld/httptreemux.TreeMux.GET方法的典型用法代码示例。如果您正苦于以下问题:Golang TreeMux.GET方法的具体用法?Golang TreeMux.GET怎么用?Golang TreeMux.GET使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/dimfeld/httptreemux.TreeMux
的用法示例。
在下文中一共展示了TreeMux.GET方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: InitializeAdmin
func InitializeAdmin(router *httptreemux.TreeMux) {
// For admin panel
router.GET("/admin/", adminHandler)
router.GET("/admin/login/", getLoginHandler)
router.POST("/admin/login/", postLoginHandler)
router.GET("/admin/register/", getRegistrationHandler)
router.POST("/admin/register/", postRegistrationHandler)
router.GET("/admin/logout/", logoutHandler)
router.GET("/admin/*filepath", adminFileHandler)
// For admin API (no trailing slash)
// Posts
router.GET("/admin/api/posts/:number", apiPostsHandler)
// Post
router.GET("/admin/api/post/:id", getApiPostHandler)
router.POST("/admin/api/post", postApiPostHandler)
router.PATCH("/admin/api/post", patchApiPostHandler)
router.DELETE("/admin/api/post/:id", deleteApiPostHandler)
// Upload
router.POST("/admin/api/upload", apiUploadHandler)
// Images
router.GET("/admin/api/images/:number", apiImagesHandler)
router.DELETE("/admin/api/image", deleteApiImageHandler)
// Blog
router.GET("/admin/api/blog", getApiBlogHandler)
router.PATCH("/admin/api/blog", patchApiBlogHandler)
// User
router.GET("/admin/api/user/:id", getApiUserHandler)
router.PATCH("/admin/api/user", patchApiUserHandler)
// User id
router.GET("/admin/api/userid", getApiUserIdHandler)
}
示例2: InitializeBlog
func InitializeBlog(router *httptreemux.TreeMux) {
// For index
router.GET("/", indexHandler)
router.GET("/:slug/", postHandler)
router.GET("/page/:number/", indexHandler)
// For author
router.GET("/author/:slug/", authorHandler)
router.GET("/author/:slug/:function/", authorHandler)
router.GET("/author/:slug/:function/:number/", authorHandler)
// For tag
router.GET("/tag/:slug/", tagHandler)
router.GET("/tag/:slug/:function/", tagHandler)
router.GET("/tag/:slug/:function/:number/", tagHandler)
// For serving asset files
router.GET("/assets/*filepath", assetsHandler)
router.GET("/images/*filepath", imagesHandler)
router.GET("/content/images/*filepath", imagesHandler) // This is here to keep compatibility with Ghost
router.GET("/public/*filepath", publicHandler)
}
示例3: InitializePages
func InitializePages(router *httptreemux.TreeMux) {
// For serving standalone projects or pages saved in in content/pages
router.GET("/pages/*filepath", pagesHandler)
}