示例#1
9
文件: router.go 项目: thedodd/api
// 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)
}
示例#2
2
func GetGroupHandler(router *gin.RouterGroup) {
	admin := router.Group("/admin").Use(jwt.GinJwtHandler).Use(jwt.GroupHandler("admin"))
	{
		admin.GET("/:prop", getProperty)
		admin.PUT("/:prop", setProperty)
	}
}
示例#3
0
// @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)
}
示例#4
0
文件: tasks.go 项目: fmr/kanban
func taskRoutes(api *gin.RouterGroup, prefix string) {

	g := api.Group(prefix)
	{
		g.DELETE(":id", deleteTask)
		g.PUT(":id/move/:new_list_id", moveTask)
	}
}
示例#5
0
// @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))
}
示例#6
0
文件: routes.go 项目: ovh/tat
// 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)
	}
}
示例#7
0
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)
	})
}
示例#8
0
文件: cards.go 项目: fmr/kanban
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)
	}

}
示例#9
0
文件: routes.go 项目: ovh/tat
// 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)
	}
}
示例#10
0
// @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))
}
示例#11
0
文件: routes.go 项目: ovh/tat
// 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)
	}
}
示例#12
0
文件: articles.go 项目: tka/goyangi
// @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))
}
示例#13
0
文件: routes.go 项目: ovh/tat
// 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)
	}
}
示例#14
0
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)
	})
}
示例#15
0
文件: routes.go 项目: ovh/tat
// initRoutesGroups initialized routes for Groups Controller
func initRoutesGroups(router *gin.RouterGroup, checkPassword gin.HandlerFunc) {
	groupsCtrl := &GroupsController{}

	g := router.Group("/")
	g.Use(checkPassword)
	{
		g.GET("/groups", groupsCtrl.List)

		g.PUT("/group/add/user", groupsCtrl.AddUser)
		g.PUT("/group/remove/user", groupsCtrl.RemoveUser)
		g.PUT("/group/add/adminuser", groupsCtrl.AddAdminUser)
		g.PUT("/group/remove/adminuser", groupsCtrl.RemoveAdminUser)

		admin := router.Group("/group")
		admin.Use(checkPassword, CheckAdmin())
		{
			admin.POST("", groupsCtrl.Create)
			admin.DELETE("edit/:group", groupsCtrl.Delete)
			admin.PUT("edit/:group", groupsCtrl.Update)
		}
	}
}
示例#16
0
func Locations(parentRoute *gin.RouterGroup) {

	route := parentRoute.Group("/locations")
	route.GET("", func(c *gin.Context) {
		sPARoute(c, "/locations")
	})
	route.GET("user/:username", func(c *gin.Context) {
		username := c.Params.ByName("username")
		sPARoute(c, "/locations/user/"+username)
	})
	route.GET("tag/:name", func(c *gin.Context) {
		name := c.Params.ByName("name")
		sPARoute(c, "/locations/tag/"+name)
	})
	route.GET("/write", func(c *gin.Context) {
		sPARoute(c, "/locations/write")
	})
	route.GET("/write/:id", func(c *gin.Context) {
		id := c.Params.ByName("id")
		sPARoute(c, "/locations/write/"+id)
	})
	route.GET("/search", func(c *gin.Context) {
		sPARoute(c, "/locations/search")
	})
	route.GET("/search/:id", func(c *gin.Context) {
		id := c.Params.ByName("id")
		sPARoute(c, "/locations/search/"+id)
	})

	route = parentRoute.Group("/location")
	route.GET("/:name/:id", func(c *gin.Context) {
		name := c.Params.ByName("name")
		id := c.Params.ByName("id")
		sPARoute(c, "/location/"+name+"/"+id)
	})

}
示例#17
0
// @Title Oauth
// @Description Oauth's router group.
func Oauth(parentRoute *gin.RouterGroup) {

	route := parentRoute.Group("/oauth")
	route.GET("", retrieveOauthStatus)

	route.GET("/google", googleAuth)
	route.DELETE("/google", userPermission.AuthRequired(googleRevoke))
	route.GET("/google/redirect", googleRedirect)

	route.GET("/github", githubAuth)
	route.DELETE("/github", userPermission.AuthRequired(githubRevoke))
	route.GET("/github/redirect", githubRedirect)

	// route.GET("/yahoo", yahooAuth)
	// route.DELETE("/yahoo", userPermission.AuthRequired(yahooRevoke))
	// route.GET("/yahoo/redirect", yahooRedirect)

	route.GET("/facebook", facebookAuth)
	route.DELETE("/facebook", userPermission.AuthRequired(facebookRevoke))
	route.GET("/facebook/redirect", facebookRedirect)

	// route.GET("/twitter", twitterAuth)
	// route.DELETE("/twitter", userPermission.AuthRequired(twitterRevoke))
	// route.GET("/twitter/redirect", twitterRedirect)

	route.GET("/linkedin", linkedinAuth)
	route.DELETE("/linkedin", userPermission.AuthRequired(linkedinRevoke))
	route.GET("/linkedin/redirect", linkedinRedirect)

	// route.GET("/kakao", kakaoAuth)
	// route.DELETE("/kakao", userPermission.AuthRequired(kakaoRevoke))
	// route.GET("/kakao/redirect", kakaoRedirect)

	// route.GET("/naver", naverAuth)
	// route.DELETE("/naver", userPermission.AuthRequired(naverRevoke))
	// route.GET("/naver/redirect", naverRedirect)
}
示例#18
0
func Articles(parentRoute *gin.RouterGroup) {
	route := parentRoute.Group("")
	route.GET("/notice", func(c *gin.Context) {
		sPARoute(c, "/notice")
	})
	route.GET("/general", func(c *gin.Context) {
		sPARoute(c, "/general")
	})
	route.GET("/etc", func(c *gin.Context) {
		sPARoute(c, "/etc")
	})
	route.GET("/noticeOne", func(c *gin.Context) {
		sPARoute(c, "/noticeOne")
	})

	route = parentRoute.Group("/articles")
	route.GET("", func(c *gin.Context) {
		sPARoute(c, "/articles")
	})
	route.GET("user/:username", func(c *gin.Context) {
		username := c.Params.ByName("username")
		sPARoute(c, "/articles/user/"+username)
	})
	route.GET("tag/:name", func(c *gin.Context) {
		name := c.Params.ByName("name")
		sPARoute(c, "/articles/tag/"+name)
	})
	route.GET("/write", func(c *gin.Context) {
		sPARoute(c, "/articles/write")
	})
	route.GET("/notice/write", func(c *gin.Context) {
		sPARoute(c, "/articles/notice/write")
	})
	route.GET("/general/write", func(c *gin.Context) {
		sPARoute(c, "/articles/general/write")
	})
	route.GET("/etc/write", func(c *gin.Context) {
		sPARoute(c, "/articles/etc/write")
	})
	route.GET("/write/:id", func(c *gin.Context) {
		id := c.Params.ByName("id")
		sPARoute(c, "/articles/write/"+id)
	})

	route = parentRoute.Group("/article")
	route.GET("/:title/:id", func(c *gin.Context) {
		title := c.Params.ByName("title")
		id := c.Params.ByName("id")
		sPARoute(c, "/article/"+title+"/"+id)
	})

}
示例#19
0
文件: routes.go 项目: ovh/tat
// initRoutesUsers initialized routes for Users Controller
func initRoutesUsers(router *gin.RouterGroup, checkPassword gin.HandlerFunc) {
	usersCtrl := &UsersController{}

	gs := router.Group("/users")
	gs.Use(checkPassword)
	{
		gs.GET("", usersCtrl.List)
	}
	g := router.Group("/user")
	g.Use(checkPassword)
	{
		g.GET("/me", usersCtrl.Me)
		g.GET("/me/contacts/:sinceSeconds", usersCtrl.Contacts)
		g.POST("/me/contacts/:username", usersCtrl.AddContact)
		g.DELETE("/me/contacts/:username", usersCtrl.RemoveContact)
		g.POST("/me/topics/*topic", usersCtrl.AddFavoriteTopic)
		g.DELETE("/me/topics/*topic", usersCtrl.RemoveFavoriteTopic)
		g.POST("/me/tags/:tag", usersCtrl.AddFavoriteTag)
		g.DELETE("/me/tags/:tag", usersCtrl.RemoveFavoriteTag)

		g.POST("/me/enable/notifications/topics/*topic", usersCtrl.EnableNotificationsTopic)
		g.POST("/me/disable/notifications/topics/*topic", usersCtrl.DisableNotificationsTopic)

		g.POST("/me/enable/notifications/alltopics", usersCtrl.EnableNotificationsAllTopics)
		g.POST("/me/disable/notifications/alltopics", usersCtrl.DisableNotificationsAllTopics)
	}

	admin := router.Group("/user")
	admin.Use(checkPassword, CheckAdmin())
	{
		admin.PUT("/convert", usersCtrl.Convert)
		admin.PUT("/archive", usersCtrl.Archive)
		admin.PUT("/rename", usersCtrl.Rename)
		admin.PUT("/update", usersCtrl.Update)
		admin.PUT("/setadmin", usersCtrl.SetAdmin)
		admin.PUT("/resetsystem", usersCtrl.ResetSystemUser)
		admin.PUT("/updatesystem", usersCtrl.UpdateSystemUser)
		admin.PUT("/check", usersCtrl.Check)
	}

	router.GET("/user/verify/:username/:tokenVerify", usersCtrl.Verify)
	router.POST("/user/reset", usersCtrl.Reset)
	router.POST("/user", usersCtrl.Create)
}
示例#20
0
func Users(parentRoute *gin.RouterGroup) {
	route := parentRoute.Group("")

	route.GET("/li", func(c *gin.Context) {
		userService.SetCookieHandler(c, "*****@*****.**", "password")
		sPARoute(c, "")
	})

	route.GET("/login", func(c *gin.Context) {
		sPARoute(c, "/login")
	})
	route.GET("/logout", func(c *gin.Context) {
		sPARoute(c, "/logout")
	})

	route.GET("/reset/password/:token", func(c *gin.Context) {
		token := c.Params.ByName("token")
		sPARoute(c, "/reset/password/"+token)
	})
	route.GET("/verify/email/:token", func(c *gin.Context) {
		token := c.Params.ByName("token")
		sPARoute(c, "/verify/email/"+token)
	})

	route = parentRoute.Group("/send")
	route.GET("/email/verification/form", func(c *gin.Context) {
		sPARoute(c, "/send/email/verification/form")
	})
	route.GET("/password/reset/form", func(c *gin.Context) {
		sPARoute(c, "/send/password/reset/form")
	})

	route = parentRoute.Group("/profile")
	route.GET("", func(c *gin.Context) {
		sPARoute(c, "profile")
	})
	route.GET("/:id", func(c *gin.Context) {
		id := c.Params.ByName("id")
		sPARoute(c, "/profile/"+id)
	})

}
示例#21
0
文件: routes.go 项目: ovh/tat
// initRoutesMessages initialized routes for Messages Controller
func initRoutesMessages(router *gin.RouterGroup, checkPassword gin.HandlerFunc) {
	messagesCtrl := &MessagesController{}

	g := router.Group("/messages")
	g.Use(checkPassword)
	{
		g.POST("/*topic", messagesCtrl.CreateBulk)
		g.GET("/*topic", messagesCtrl.List)
		g.DELETE("/nocascade/*topic", messagesCtrl.DeleteBulk)
		g.DELETE("/cascade/*topic", messagesCtrl.DeleteBulkCascade)
		g.DELETE("/cascadeforce/*topic", messagesCtrl.DeleteBulkCascadeForce)
	}

	r := router.Group("/read")
	r.Use()
	{
		r.GET("/*topic", messagesCtrl.List)
	}

	gm := router.Group("/message")
	gm.Use(checkPassword)
	{
		//Create a message, a reply
		gm.POST("/*topic", messagesCtrl.Create)

		// Like, Unlike, Label, Unlabel a message, mark as task, voteup, votedown, unvoteup, unvotedown
		gm.PUT("/*topic", messagesCtrl.Update)

		// Delete a message
		gm.DELETE("/nocascade/:idMessage/*topic", messagesCtrl.Delete)

		// Delete a message and its replies
		gm.DELETE("/cascade/:idMessage/*topic", messagesCtrl.DeleteCascade)

		// Delete a message and its replies, event if it's in a Tasks Topic of one user
		gm.DELETE("/cascadeforce/:idMessage/*topic", messagesCtrl.DeleteCascadeForce)
	}
}
示例#22
0
// Register registers the route handlers for this controller
func (f *FeedController) Register(r *gin.RouterGroup) {
	front := r.Group("/feed")
	{
		front.POST("/receive", f.postReceive)
	}
}
示例#23
0
// @Title Experiments
// @Description Experiments's router group. It contains API in experiments.
func Experiments(parentRoute *gin.RouterGroup) {

	route := parentRoute.Group("/experiments")
	route.GET("", test)
}
示例#24
0
// @Title Authentications
// @Description Authentications's router group.
func Authentications(parentRoute *gin.RouterGroup) {
	route := parentRoute.Group("/authentications")
	route.POST("", createUserAuthentication)
	route.DELETE("", deleteUserAuthentication)
}
示例#25
0
func InitApi(r *gin.RouterGroup) {
	r.Use(recoverWrapper())
	r.Use(basicAuthorizer())

	InitBuildsController(r.Group("/builds"))
}
示例#26
0
func SetupRoute(router *gin.RouterGroup) {
	solderRoutes := router.Group("/:userId/api")
	solderRoutes.GET("/", rootHandler)
	solderRoutes.GET("/*modname/*modversion", modHandler)
}
示例#27
-5
// @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))
}