本文整理汇总了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)
}
示例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)
}
示例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")
}
示例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))
}
示例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")
}
示例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
}
示例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
}
示例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)
}
示例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))
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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))
}
示例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)
}