本文整理匯總了Golang中github.com/gin-gonic/gin.RouterGroup.GET方法的典型用法代碼示例。如果您正苦於以下問題:Golang RouterGroup.GET方法的具體用法?Golang RouterGroup.GET怎麽用?Golang RouterGroup.GET使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/gin-gonic/gin.RouterGroup
的用法示例。
在下文中一共展示了RouterGroup.GET方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Register
func (u *UserResource) Register(usergroup *gin.RouterGroup) {
usergroup.OPTIONS("login")
usergroup.GET("login", u.login)
usergroup.GET("find/:user-id", u.findUser)
usergroup.PUT("update/:user-id", u.updateUser)
usergroup.DELETE("remove/:user-id", u.removeUser)
}
示例2: Routes
func Routes(oauth *oauth2.Config, r *gin.RouterGroup) {
passportOauth = oauth
r.GET("/login", func(c *gin.Context) {
Login(oauth, c)
})
}
示例3: Listen
// Listen Tells Gin API to start
func Listen(iface string, s *discordgo.Session, logger *logging.Logger) {
// set the refs to point to main
var v1 *gin.RouterGroup
session = s
c := config.Get()
log = logger
if c.LogLevel != "debug" {
gin.SetMode(gin.ReleaseMode)
}
//r := gin.Default()
r := gin.New()
r.Use(loggerino())
r.Use(gin.Recovery())
if c.APIPassword != "" {
log.Info("Basic Authentication enabled for API")
v1 = r.Group("/v1", gin.BasicAuth(gin.Accounts{
c.APIUsername: c.APIPassword,
}))
} else {
log.Warning("DIGO_API_PASSWORD and DIGO_API_USERNAME are not set")
log.Warning("The API is open to all requests")
v1 = r.Group("/v1")
}
v1.GET("/version", versionV1)
v1.GET("/channels", channelsV1)
v1.POST("/message", messageV1)
go r.Run(iface)
log.Noticef("Digo API is listening on %s", c.APIInterface)
}
示例4: Setup
// Setup configures how to handle routes
func Setup(group *gin.RouterGroup, db *db.DB) {
group.Use()
{
group.GET("/", renderItemHandler(db))
group.GET("/:shortcode", renderItemHandler(db))
}
}
示例5: Person
func Person(router *gin.RouterGroup) {
router.GET("/persons", handler.GetAll)
router.GET("/person/:id", handler.GetById)
router.POST("/person", handler.Create)
router.PUT("/person", handler.Update)
router.DELETE("/person", handler.Delete)
}
示例6: Use
// Use is a function
func Use(r *gin.RouterGroup) {
r.Use()
{
r.GET("/image/all", getAllImages)
r.GET("/image/search", getSearchImages)
r.POST("/image", createImage)
}
}
示例7: NewSshController
func NewSshController(s *gin.RouterGroup) *SshController {
ctl := &SshController{}
s.GET("/ssh/public-key", ctl.getPublicKey)
return ctl
}
示例8: NewDeploymentController
func NewDeploymentController(s *gin.RouterGroup) *DeploymentController {
ctl := &DeploymentController{}
s.GET("/apps/:id/deploy/:deploy_id", ctl.getDeployment)
s.GET("/apps/:id/deploy", ctl.getDeploymentList)
return ctl
}
示例9: Setup
// Setup will setup all API routes.
func Setup(group *gin.RouterGroup, db *db.DB) {
group.Use()
{
group.GET("/items/:code", itemsShowHandler(db))
group.DELETE("/items/:code", itemsDestroyHandler(db))
group.GET("/items", itemsIndexHandler(db))
group.POST("/items", itemsCreateHandler(db))
}
}
示例10: Use
// Use is an exported function that
// define routing for user
func Use(r *gin.RouterGroup) {
r.Use()
{
r.GET("/user", getUsers)
r.GET("/user/:id", getUser)
r.POST("/user", postUser)
r.PATCH("/user/:id", updateUser)
r.DELETE("/user/:id", deleteUser)
}
}
示例11: NewBuildController
func NewBuildController(s *gin.RouterGroup) *BuildController {
ctl := &BuildController{}
s.POST("/apps/:id/builds", ctl.postBuild)
s.GET("/apps/:id/builds", ctl.getBuildList)
s.POST("/apps/:id/builds/:build_id/deploy", ctl.postBuildDeploy)
return ctl
}
示例12: 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)
}
}
示例13: NewConfigController
func NewConfigController(s *gin.RouterGroup) *ConfigController {
ctl := &ConfigController{}
s.POST("/apps/:id/configs", ctl.postConfig)
s.PUT("/apps/:id/configs/:config_id", ctl.putConfig)
s.GET("/apps/:id/configs", ctl.getConfigList)
s.GET("/apps/:id/configs/:config_id", ctl.getConfig)
return ctl
}
示例14: RealMain
func RealMain(routerGroup *gin.RouterGroup) {
routerGroup.GET("/users", func(c *gin.Context) {
data := User{
ID: 1,
Name: "Widnyana",
Email: "[email protected]",
}
c.JSON(200, data)
})
}
示例15: ConfigureRoutes
// ConfigureRoutes configures the routes for this controller
func (dc *DownloadsController) ConfigureRoutes(route *gin.RouterGroup) {
route.POST("downloadPacket", dc.downloadPacket)
route.POST("startDirectDownload", dc.startDirectDownload)
route.GET("listDownloads", dc.listDownloads)
route.POST("stopDownload", dc.stopDownload)
route.POST("cancelDownload", dc.cancelDownload)
route.POST("resumeDownload", dc.resumeDownload)
route.GET("loadFiles", dc.loadFiles)
route.POST("deleteFiles", dc.deleteFiles)
route.POST("moveFilesToMovies", dc.moveFilesToMovies)
}