当前位置: 首页>>代码示例>>Golang>>正文


Golang Router.POST方法代码示例

本文整理汇总了Golang中github.com/julienschmidt/httprouter.Router.POST方法的典型用法代码示例。如果您正苦于以下问题:Golang Router.POST方法的具体用法?Golang Router.POST怎么用?Golang Router.POST使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/julienschmidt/httprouter.Router的用法示例。


在下文中一共展示了Router.POST方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: AddRoutes

func AddRoutes(router *httprouter.Router) {
	mylog.Debugf("enter notice.AddRoutes(%+v)", router)
	defer func() { mylog.Debugf("exit action.Handler(%+v)", router) }()

	controller := &controller{&actionList}
	router.POST("/action", controller.Post)
}
开发者ID:robertocs,项目名称:cepiot,代码行数:7,代码来源:action_controller.go

示例2: setupApi2

// Setup all routes for API v2
func setupApi2(router *httprouter.Router) {
	router.GET("/api/v2", APIv2.ApiIndexVersion)

	// Public Statistics
	router.GET("/api/v2/websites", APIv2.ApiWebsites)
	router.GET("/api/v2/websites/:url/status", APIv2.ApiWebsitesStatus)
	router.GET("/api/v2/websites/:url/results", APIv2.ApiWebsitesResults)

	// Authentication
	router.POST("/api/v2/auth/login", APIv2.ApiAuthLogin)
	router.GET("/api/v2/auth/logout", APIv2.ApiAuthLogout)

	// Settings
	router.PUT("/api/v2/settings/password", APIv2.ApiSettingsPassword)
	router.PUT("/api/v2/settings/interval", APIv2.ApiSettingsInterval)

	// Website Management
	router.POST("/api/v2/websites/:url", APIv2.ApiWebsitesAdd)
	router.PUT("/api/v2/websites/:url", APIv2.ApiWebsitesEdit)
	router.DELETE("/api/v2/websites/:url", APIv2.ApiWebsitesDelete)
	router.PUT("/api/v2/websites/:url/enabled", APIv2.ApiWebsitesEnabled)
	router.PUT("/api/v2/websites/:url/visibility", APIv2.ApiWebsitesVisibility)
	router.GET("/api/v2/websites/:url/notifications", APIv2.ApiWebsitesGetNotifications)
	router.PUT("/api/v2/websites/:url/notifications", APIv2.ApiWebsitePutNotifications)
	router.GET("/api/v2/websites/:url/check", APIv2.ApiWebsiteCheck)
}
开发者ID:MarvinMenzerath,项目名称:UpAndRunning2,代码行数:27,代码来源:main.go

示例3: Register

func (c *streamController) Register(router *httprouter.Router) {
	router.PUT("/streams", basicAuth(c.handle(c.addToStream), c.authConfig))
	router.POST("/streams/coalesce", basicAuth(c.handle(c.coalesceStreams), c.authConfig))
	router.GET("/stream/:id", basicAuth(c.handle(c.getStream), c.authConfig))

	log.Debug("Routes Registered")
}
开发者ID:rtyer,项目名称:streams,代码行数:7,代码来源:stream_controller.go

示例4: AddAdminRoutes

//AddAdminRoutes Adds all the admin routes that need user login
func AddAdminRoutes(router *httprouter.Router, a *application.App) {
	router.GET("/"+adminPrefix, admin.GETDashboardIndex(a))
	router.GET("/"+adminPrefix+"/logout", admin.GETDashboardLogout(a))
	router.GET("/"+adminPrefix+"/users/new", admin.GETUsersNew(a))
	router.POST("/"+adminPrefix+"/users/new", admin.POSTUsersNew(a))
	router.GET("/"+adminPrefix+"/profile", admin.GETDashboardProfile(a))
	router.POST("/"+adminPrefix+"/profile", admin.POSTDashboardProfile(a))
}
开发者ID:skmetaly,项目名称:pbblog,代码行数:9,代码来源:routes.go

示例5: Register

func (c *streamController) Register(router *httprouter.Router) {
	router.PUT("/streams", basicAuth(timeRequest(c.handle(c.addToStream), addToStreamTimer), c.authConfig))
	router.DELETE("/streams", basicAuth(timeRequest(c.handle(c.removeFromStream), removeFromStreamTimer), c.authConfig))
	router.POST("/streams/coalesce", basicAuth(timeRequest(c.handle(c.coalesceStreams), coalesceTimer), c.authConfig))
	router.GET("/stream/:id", basicAuth(timeRequest(c.handle(c.getStream), getStreamTimer), c.authConfig))

	log.Debug("Routes Registered")
}
开发者ID:ello,项目名称:streams,代码行数:8,代码来源:stream_controller.go

示例6: SetupRoutes

// SetupRoutes maps routes to the PubSub's handlers
func (ps *PubSub) SetupRoutes(router *httprouter.Router) *httprouter.Router {
	router.POST("/:topic_name", ps.PublishMessage)
	router.POST("/:topic_name/:subscriber_name", ps.Subscribe)
	router.DELETE("/:topic_name/:subscriber_name", ps.Unsubscribe)
	router.GET("/:topic_name/:subscriber_name", ps.GetMessages)

	return router
}
开发者ID:pengux,项目名称:pub-sub,代码行数:9,代码来源:pubsub.go

示例7: httpRoutes

func (c *ChatService) httpRoutes(prefix string, router *httprouter.Router) http.Handler {
	router.POST(prefix+"/push", c.onPushPost)
	router.POST(prefix+"/register", c.onPushSubscribe)

	router.GET(prefix+"/channel/:id/message", c.onGetChatHistory)
	router.GET(prefix+"/channel/:id/message/:msg_id", c.onGetChatMessage)
	router.GET(prefix+"/channel", c.onGetChannels)
	return router
}
开发者ID:CHH-Darick,项目名称:raspchat,代码行数:9,代码来源:chat_service.go

示例8: Register

func (d *Dump) Register(r *httprouter.Router) {
	r.GET("/dump", d.GetDumps)
	r.GET("/dump/:type", d.GetDumpsForType)
	r.GET("/dump/:type/:id", d.Get)
	r.DELETE("/dump/:type/:id", d.Delete)
	r.POST("/dump/:type", d.Create)
	r.GET("/dumpremote", d.GetAllRemoteDumps)
	r.GET("/dumpremote/:name", d.GetRemoteDumps)
}
开发者ID:janhalfar,项目名称:dumpster,代码行数:9,代码来源:dump.go

示例9: Register

func (e authEndpoint) Register(mux *httprouter.Router) {
	mux.GET("/register", jsonHandler(func() interface{} {
		return &defaultRegisterFlows
	}))
	mux.GET("/login", jsonHandler(func() interface{} {
		return &defaultLoginFlows
	}))
	mux.POST("/register", jsonHandler(e.postRegister))
	mux.POST("/login", jsonHandler(e.postLogin))
}
开发者ID:rezacute,项目名称:bullettime,代码行数:10,代码来源:auth.go

示例10: AddRoutes

func AddRoutes(router *httprouter.Router) {
	mylog.Debugf("enter rule.AddRoutes(%+v)", router)
	defer func() { mylog.Debugf("exit rule.AddRoutes(%+v)", router) }()

	controller := &controller{}
	router.GET("/rules", controller.GetAll)
	router.GET("/rules/:name", controller.Get)
	router.POST("/rules", controller.Post)
	router.DELETE("/rules/:name", controller.Del)
}
开发者ID:robertocs,项目名称:cepiot,代码行数:10,代码来源:rule_controller.go

示例11: AddRoutes

// Add routes to http router
// TODO: Add route description parameters and useage
func AddRoutes(router *httprouter.Router) {
	router.GET("/actions", Actions)
	router.GET("/actions/:ActionId", ActionById)
	router.POST("/set/:SetId", PostAction)
	router.GET("/actions/:ActionId/occrurrences", Occurrences)
	router.GET("/occurrences/:OccurrenceId", OccurrenceById)

	// TODO:
	// router.POST("/actions/:ActionId", postOccurrence)
	// router.GET("/sets", sets)
	// router.GET("/sets/:SetId/actions", actionsFromSet)
}
开发者ID:zaquestion,项目名称:ambition,代码行数:14,代码来源:routes.go

示例12: setMySQLHandlers

func setMySQLHandlers(r *httprouter.Router) {
	r.GET("/MySQL", MySQL) // Read

	// GET Handlers
	r.GET("/Create", Create)
	r.GET("/Update/:ID", Update)
	r.GET("/Delete/:ID", Delete)

	//Post Handlers
	r.POST("/Create", CreateP)
	r.POST("/Update/:ID", UpdateP)
}
开发者ID:falmar,项目名称:ego,代码行数:12,代码来源:mysql.go

示例13: RegisterRoutes

// RegisterRoutes initializes the routes for the service
func RegisterRoutes(r *httprouter.Router) {
	UC := controllers.NewUserController()
	AC := controllers.NewAdventureController()

	r.GET("/users/:id", UC.Get)
	r.POST("/users", UC.Create)
	r.DELETE("/users/:id", UC.Remove)

	r.GET("/adventures", AC.GetAll)
	r.GET("/adventures/:id", AC.Get)
	r.POST("/adventures", AC.Create)
	r.DELETE("/adventures/:id", AC.Remove)
}
开发者ID:adventure-awaits,项目名称:api,代码行数:14,代码来源:routes.go

示例14: addUsersHandlers

// addUsersHandlers add Users handler to router
func addUsersHandlers(router *httprouter.Router) {
	// add user
	router.POST("/users/:user", wrapHandler(usersAdd))

	// get all users
	router.GET("/users", wrapHandler(usersGetAll))

	// get one user
	router.GET("/users/:user", wrapHandler(usersGetOne))

	// del an user
	router.DELETE("/users/:user", wrapHandler(usersDel))
}
开发者ID:ro78,项目名称:tmail,代码行数:14,代码来源:handlers_users.go

示例15: SetRoutes

//SetRoutes sets the controllers routes in given router
func (c *Controller) SetRoutes(router *httprouter.Router) {
	router.GET("/games", c.ListGames)
	router.POST("/games", c.NewGame)
	router.GET("/games/:id", c.PrintGameState)
	router.POST("/games/:id/move", c.ApplyMove)
	router.POST("/games/:id/init", c.InitGame)
	router.POST("/games/:id/start", c.StartGame)
}
开发者ID:tehleach,项目名称:hue,代码行数:9,代码来源:controller.go


注:本文中的github.com/julienschmidt/httprouter.Router.POST方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。