本文整理匯總了Golang中github.com/gin-gonic/gin.RouterGroup.Group方法的典型用法代碼示例。如果您正苦於以下問題:Golang RouterGroup.Group方法的具體用法?Golang RouterGroup.Group怎麽用?Golang RouterGroup.Group使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gin-gonic/gin.RouterGroup
的用法示例。
在下文中一共展示了RouterGroup.Group方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetGroupHandler
func GetGroupHandler(router *gin.RouterGroup) {
admin := router.Group("/admin").Use(jwt.GinJwtHandler).Use(jwt.GroupHandler("admin"))
{
admin.GET("/:prop", getProperty)
admin.PUT("/:prop", setProperty)
}
}
示例2: Users
// @Title Users
// @Description Users's router group.
func Users(parentRoute *gin.RouterGroup) {
route := parentRoute.Group("/users")
route.POST("", createUser)
route.GET("/:id", retrieveUser)
route.GET("", retrieveUsers)
route.PUT("/:id", userPermission.AuthRequired(updateUser))
route.DELETE("/:id", userPermission.AuthRequired(deleteUser))
route.POST("/roles", userPermission.AdminRequired(addRoleToUser))
route.DELETE(":id/roles/:roleId", userPermission.AdminRequired(removeRoleFromUser))
route.POST("/likings", userPermission.AuthRequired(createLikingOnUser))
route.GET("/:id/likings", retrieveLikingsOnUsers)
route.DELETE("/:id/likings/:userId", userPermission.AuthRequired(deleteLikingOnUser))
route.GET("/:id/liked", retrieveLikedOnUsers)
route = parentRoute.Group("/user")
route.GET("/current", retrieveCurrentUser)
route.POST("/send/password/reset/token", sendPasswordResetToken)
route.PUT("/reset/password", resetPassword)
route.POST("/send/email/verification/token", sendEmailVerificationToken)
route.PUT("/verify/email", verifyEmail)
route.GET("/email/:email", retrieveUserByEmail)
route.GET("/email/:email/list", retrieveUsersByEmail)
route.GET("/username/:username", retrieveUserByUsername)
route.GET("/admin/:id", userPermission.AdminRequired(retrieveUserForAdmin))
route.GET("/admin", userPermission.AdminRequired(retrieveUsersForAdmin))
route.PUT("/activate/:id", userPermission.AdminRequired(activateUser))
route.GET("/test/send/email", sendTestEmail)
}
示例3: taskRoutes
func taskRoutes(api *gin.RouterGroup, prefix string) {
g := api.Group(prefix)
{
g.DELETE(":id", deleteTask)
g.PUT(":id/move/:new_list_id", moveTask)
}
}
示例4: Roles
// @Title Roles
// @Description Roles's router group.
func Roles(parentRoute *gin.RouterGroup) {
route := parentRoute.Group("/roles")
route.POST("", userPermission.AdminRequired(createRole))
route.GET("/:id", retrieveRole)
route.GET("", retrieveRoles)
route.PUT("/:id", userPermission.AdminRequired(updateRole))
route.DELETE("/:id", userPermission.AdminRequired(deleteRole))
}
示例5: BindRoutes
// BindRoutes bind this package's routes to the given gin.RouterGroup at the given base URI.
func BindRoutes(baseRouter *gin.RouterGroup, baseURI string) {
router := baseRouter.Group(baseURI)
// Register routes.
router.Use(common.BasicAuthRequired) // Protect these resources with basic auth.
router.GET("/builds/", GetElasticsearchBuilds)
router.POST("/builds/", common.BindJSON(&BuildModel{}), CreateElasticsearchBuild)
router.GET("/builds/:id", GetElasticsearchBuildByID)
}
示例6: Upload
// @Title Upload
// @Description Upload's router group.
func Upload(parentRoute *gin.RouterGroup) {
route := parentRoute.Group("/upload")
route.POST("/images", userPermission.AuthRequired(uploadImages))
route.POST("/files", userPermission.AuthRequired(createFile))
route.POST("/files/all", userPermission.AuthRequired(createFiles))
route.GET("/files/:id", retrieveFile)
route.GET("/files", retrieveFiles)
route.PUT("/files/:id", userPermission.AuthRequired(updateFile))
route.DELETE("/files/:id", userPermission.AuthRequired(deleteFile))
}
示例7: initRoutesSystem
// initRoutesSystem initialized routes for System Controller
func initRoutesSystem(router *gin.RouterGroup, checkPassword gin.HandlerFunc) {
systemCtrl := &SystemController{}
router.GET("/version", systemCtrl.GetVersion)
router.GET("/capabilities", systemCtrl.GetCapabilites)
admin := router.Group("/system")
admin.Use(checkPassword, CheckAdmin())
{
admin.GET("/cache/clean", systemCtrl.CleanCache)
admin.GET("/cache/info", systemCtrl.CleanInfo)
}
}
示例8: Setting
func Setting(parentRoute *gin.RouterGroup) {
route := parentRoute
route = parentRoute.Group("/setting")
route.GET("", func(c *gin.Context) {
sPARoute(c, "/setting")
})
route.GET("/:tab", func(c *gin.Context) {
tab := c.Params.ByName("tab")
sPARoute(c, "/setting/"+tab)
})
}
示例9: cardRoutes
func cardRoutes(api *gin.RouterGroup, prefix string) {
g := api.Group(prefix)
{
g.GET("", getCards)
g.POST("", addCard)
g.DELETE(":id", deleteCard)
g.PUT(":id", updateCard)
g.PUT(":id/move/:target_id", moveCard)
g.POST(":id/add/", addTask)
}
}
示例10: initRoutesTopics
// initRoutesTopics initialized routes for Topics Controller
func initRoutesTopics(router *gin.RouterGroup, checkPassword gin.HandlerFunc) {
topicsCtrl := &TopicsController{}
g := router.Group("/")
g.Use(checkPassword)
{
g.GET("/topics", topicsCtrl.List)
g.POST("/topic", topicsCtrl.Create)
g.DELETE("/topic/*topic", topicsCtrl.Delete)
g.GET("/topic/*topic", topicsCtrl.OneTopic)
g.PUT("/topic/add/parameter", topicsCtrl.AddParameter)
g.PUT("/topic/remove/parameter", topicsCtrl.RemoveParameter)
g.PUT("/topic/add/filter", topicsCtrl.AddFilter)
g.PUT("/topic/remove/filter", topicsCtrl.RemoveFilter)
g.PUT("/topic/update/filter", topicsCtrl.UpdateFilter)
g.PUT("/topic/add/rouser", topicsCtrl.AddRoUser)
g.PUT("/topic/remove/rouser", topicsCtrl.RemoveRoUser)
g.PUT("/topic/add/rwuser", topicsCtrl.AddRwUser)
g.PUT("/topic/remove/rwuser", topicsCtrl.RemoveRwUser)
g.PUT("/topic/add/adminuser", topicsCtrl.AddAdminUser)
g.PUT("/topic/remove/adminuser", topicsCtrl.RemoveAdminUser)
g.PUT("/topic/compute/tags", topicsCtrl.ComputeTags)
g.PUT("/topic/truncate/tags", topicsCtrl.TruncateTags)
g.PUT("/topic/compute/labels", topicsCtrl.ComputeLabels)
g.PUT("/topic/truncate/labels", topicsCtrl.TruncateLabels)
g.PUT("/topic/truncate", topicsCtrl.Truncate)
g.PUT("/topic/add/rogroup", topicsCtrl.AddRoGroup)
g.PUT("/topic/remove/rogroup", topicsCtrl.RemoveRoGroup)
g.PUT("/topic/add/rwgroup", topicsCtrl.AddRwGroup)
g.PUT("/topic/remove/rwgroup", topicsCtrl.RemoveRwGroup)
g.PUT("/topic/add/admingroup", topicsCtrl.AddAdminGroup)
g.PUT("/topic/remove/admingroup", topicsCtrl.RemoveAdminGroup)
g.PUT("/topic/param", topicsCtrl.SetParam)
}
admin := router.Group("/topics")
admin.Use(checkPassword, CheckAdmin())
{
admin.PUT("/compute/tags", topicsCtrl.AllComputeTags)
admin.PUT("/compute/labels", topicsCtrl.AllComputeLabels)
admin.PUT("/compute/replies", topicsCtrl.AllComputeReplies)
admin.PUT("/migrate/dedicated/*topic", topicsCtrl.MigrateToDedicatedTopic)
admin.PUT("/migrate/dedicatedmessages/:limit/*topic", topicsCtrl.MigrateMessagesForDedicatedTopic)
admin.PUT("/param", topicsCtrl.AllSetParam)
}
}
示例11: Locations
// @Title Locations
// @Description Locations's router group.
func Locations(parentRoute *gin.RouterGroup) {
route := parentRoute.Group("/locations")
route.POST("", userPermission.AuthRequired(createLocation))
route.GET("/:id", retrieveLocation)
route.GET("", retrieveLocations)
route.PUT("/:id", userPermission.AuthRequired(updateLocation))
route.DELETE("/:id", userPermission.AuthRequired(deleteLocation))
route.POST("/comments", userPermission.AuthRequired(createCommentOnLocation))
route.GET("/:id/comments", retrieveCommentsOnLocation)
route.PUT("/:id/comments/:commentId", userPermission.AuthRequired(updateCommentOnLocation))
route.DELETE("/:id/comments/:commentId", userPermission.AuthRequired(deleteCommentOnLocation))
route.POST("/likings", userPermission.AuthRequired(createLikingOnLocation))
route.GET("/:id/likings", retrieveLikingsOnLocations)
route.DELETE("/:id/likings/:userId", userPermission.AuthRequired(deleteLikingOnLocation))
}
示例12: initRoutesStats
// initRoutesStats initialized routes for Stats Controller
func initRoutesStats(router *gin.RouterGroup, checkPassword gin.HandlerFunc) {
statsCtrl := &StatsController{}
admin := router.Group("/stats")
admin.Use(checkPassword, CheckAdmin())
{
admin.GET("/count", statsCtrl.Count)
admin.GET("/instance", statsCtrl.Instance)
admin.GET("/distribution/topics", statsCtrl.DistributionTopics)
admin.GET("/db/stats", statsCtrl.DBStats)
admin.GET("/db/replSetGetConfig", statsCtrl.DBReplSetGetConfig)
admin.GET("/db/serverStatus", statsCtrl.DBServerStatus)
admin.GET("/db/replSetGetStatus", statsCtrl.DBReplSetGetStatus)
admin.GET("/db/collections", statsCtrl.DBStatsCollections)
admin.GET("/db/slowestQueries", statsCtrl.DBGetSlowestQueries)
admin.GET("/checkHeaders", statsCtrl.CheckHeaders)
}
}
示例13: Articles
// @Title Articles
// @Description Article's router group.
func Articles(parentRoute *gin.RouterGroup) {
route := parentRoute.Group("/articles")
route.POST("", userPermission.AuthRequired(createArticle))
route.POST("/all", userPermission.AuthRequired(createArticles))
route.GET("/:id", retrieveArticle)
route.GET("", retrieveArticles)
route.PUT("/:id", userPermission.AuthRequired(updateArticle))
route.DELETE("/:id", userPermission.AuthRequired(deleteArticle))
route.POST("/comments", userPermission.AuthRequired(createCommentOnArticle))
route.GET("/:id/comments", retrieveCommentsOnArticle)
route.PUT("/:id/comments/:commentId", userPermission.AuthRequired(updateCommentOnArticle))
route.DELETE("/:id/comments/:commentId", userPermission.AuthRequired(deleteCommentOnArticle))
route.POST("/likings", userPermission.AuthRequired(createLikingOnArticle))
route.GET("/:id/likings", retrieveLikingsOnArticles)
route.DELETE("/:id/likings/:userId", userPermission.AuthRequired(deleteLikingOnArticle))
}
示例14: initRoutesPresences
// initRoutesPresences initialized routes for Presences Controller
func initRoutesPresences(router *gin.RouterGroup, checkPassword gin.HandlerFunc) {
presencesCtrl := &PresencesController{}
g := router.Group("/")
g.Use(checkPassword)
{
// List Presences
g.GET("presences", presencesCtrl.List)
g.GET("presences/*topic", presencesCtrl.List)
// Add a presence and get list
g.POST("presenceget/*topic", presencesCtrl.CreateAndGet)
// delete a presence
g.DELETE("presences/*topic", presencesCtrl.Delete)
}
admin := router.Group("/presencesadmin")
admin.Use(checkPassword, CheckAdmin())
{
admin.GET("/checkall", presencesCtrl.CheckAllPresences)
}
}
示例15: Admin
func Admin(parentRoute *gin.RouterGroup) {
route := parentRoute
route.GET("/log/access", func(c *gin.Context) {
c.File(config.AccessLogFilePath + config.AccessLogFileExtension)
})
route.GET("log/error", func(c *gin.Context) {
c.File(config.ErrorLogFilePath + config.ErrorLogFileExtension)
})
route = parentRoute.Group("/admin")
route.GET("/:type", func(c *gin.Context) {
typeName := c.Params.ByName("type")
sPARoute(c, "/admin/"+typeName)
})
route.GET("/:type/:page", func(c *gin.Context) {
typeName := c.Params.ByName("type")
page := c.Params.ByName("page")
sPARoute(c, "/admin/"+typeName+"/"+page)
})
}