當前位置: 首頁>>代碼示例>>Golang>>正文


Golang RouterGroup.GET方法代碼示例

本文整理匯總了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)
}
開發者ID:SimiPro,項目名稱:letsgo,代碼行數:7,代碼來源:user-resource.go

示例2: Routes

func Routes(oauth *oauth2.Config, r *gin.RouterGroup) {
	passportOauth = oauth

	r.GET("/login", func(c *gin.Context) {
		Login(oauth, c)
	})
}
開發者ID:durango,項目名稱:gin-passport-facebook,代碼行數:7,代碼來源:main.go

示例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)
}
開發者ID:Skullever,項目名稱:digo,代碼行數:36,代碼來源:api.go

示例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))
	}
}
開發者ID:bubblebox,項目名稱:server,代碼行數:8,代碼來源:web.go

示例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)
}
開發者ID:dynastymasra,項目名稱:GoGinThrift,代碼行數:7,代碼來源:person.go

示例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)
	}
}
開發者ID:HakabaV3,項目名稱:atami-go,代碼行數:9,代碼來源:image.go

示例7: NewSshController

func NewSshController(s *gin.RouterGroup) *SshController {

	ctl := &SshController{}

	s.GET("/ssh/public-key", ctl.getPublicKey)

	return ctl
}
開發者ID:KarhuTeam,項目名稱:Karhu,代碼行數:8,代碼來源:ssh_controller.go

示例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
}
開發者ID:KarhuTeam,項目名稱:Karhu,代碼行數:9,代碼來源:deployment_controller.go

示例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))
	}
}
開發者ID:bubblebox,項目名稱:server,代碼行數:10,代碼來源:api.go

示例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)
	}
}
開發者ID:HakabaV3,項目名稱:atami-go,代碼行數:12,代碼來源:user.go

示例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
}
開發者ID:KarhuTeam,項目名稱:Karhu,代碼行數:10,代碼來源:build_controller.go

示例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)
	}
}
開發者ID:ovh,項目名稱:tat,代碼行數:12,代碼來源:routes.go

示例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
}
開發者ID:KarhuTeam,項目名稱:Karhu,代碼行數:11,代碼來源:config_controller.go

示例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)
	})
}
開發者ID:widnyana,項目名稱:madara,代碼行數:11,代碼來源:show.go

示例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)
}
開發者ID:kahoona77,項目名稱:emerald,代碼行數:12,代碼來源:downloads.go


注:本文中的github.com/gin-gonic/gin.RouterGroup.GET方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。