本文整理汇总了Golang中github.com/julienschmidt/httprouter.Router.DELETE方法的典型用法代码示例。如果您正苦于以下问题:Golang Router.DELETE方法的具体用法?Golang Router.DELETE怎么用?Golang Router.DELETE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/julienschmidt/httprouter.Router
的用法示例。
在下文中一共展示了Router.DELETE方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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)
}
示例2: 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
}
示例3: 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")
}
示例4: 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)
}
示例5: addQueueHandlers
// addQueueHandlers add Queue handlers to router
func addQueueHandlers(router *httprouter.Router) {
// get all message in queue
router.GET("/queue", wrapHandler(queueGetMessages))
// get a message by id
router.GET("/queue/:id", wrapHandler(queueGetMessage))
// discard a message
router.DELETE("/queue/discard/:id", wrapHandler(queueDiscardMessage))
// bounce a message
router.DELETE("/queue/bounce/:id", wrapHandler(queueBounceMessage))
}
示例6: 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)
}
示例7: RegisterRoutes
func (api *HTTPAPI) RegisterRoutes(r *httprouter.Router) {
r.POST("/storage/providers", api.CreateProvider)
r.POST("/storage/providers/:provider_id/volumes", api.Create)
r.GET("/storage/volumes", api.List)
r.GET("/storage/volumes/:volume_id", api.Inspect)
r.DELETE("/storage/volumes/:volume_id", api.Destroy)
r.PUT("/storage/volumes/:volume_id/snapshot", api.Snapshot)
// takes host and volID parameters, triggers a send on the remote host and give it a list of snaps already here, and pipes it into recv
r.POST("/storage/volumes/:volume_id/pull_snapshot", api.Pull)
// responds with a snapshot stream binary. only works on snapshots, takes 'haves' parameters, usually called by a node that's servicing a 'pull_snapshot' request
r.GET("/storage/volumes/:volume_id/send", api.Send)
}
示例8: 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))
}
示例9: 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)
}
示例10: RegisterRoutes
func (h *jobAPI) RegisterRoutes(r *httprouter.Router) error {
r.GET("/host/jobs", h.ListJobs)
r.GET("/host/jobs/:id", h.GetJob)
r.PUT("/host/jobs/:id", h.AddJob)
r.DELETE("/host/jobs/:id", h.StopJob)
r.PUT("/host/jobs/:id/signal/:signal", h.SignalJob)
r.POST("/host/pull/images", h.PullImages)
r.POST("/host/pull/binaries", h.PullBinariesAndConfig)
r.POST("/host/discoverd", h.ConfigureDiscoverd)
r.POST("/host/network", h.ConfigureNetworking)
r.GET("/host/status", h.GetStatus)
r.POST("/host/resource-check", h.ResourceCheck)
r.POST("/host/update", h.Update)
r.POST("/host/tags", h.UpdateTags)
return nil
}
示例11: SetupHTTP
// setupHTTP attaches all the needed handlers to provide the HTTP API.
func (m *Manta) SetupHTTP(mux *httprouter.Router) {
baseRoute := "/" + m.ServiceInstance.UserAccount
mux.NotFound = ErrNotFound
mux.MethodNotAllowed = ErrNotAllowed
mux.RedirectFixedPath = true
mux.RedirectTrailingSlash = true
mux.HandleMethodNotAllowed = true
// this particular route can't be handled by httprouter correctly due to its
// handling of positional parameters but we can't just pass in ErrNotAllowed
// either because it's the wrong type
handleNotAllowed := func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
w.WriteHeader(http.StatusMethodNotAllowed)
w.Header().Set("Content-Type", "text/plain; charset=UTF-8")
w.Write([]byte("Method is not allowed"))
}
mux.POST(baseRoute+"/stor", handleNotAllowed)
// storage APIs
// PutSnapLink and PutMetaData have the same route spec as other routes
// in this group, which isn't permitted by httprouter. We pick up the
// correct path in the handler
mux.PUT(baseRoute+"/stor/:dir", m.handler((*Manta).handleStorage)) // PutDirectory
mux.GET(baseRoute+"/stor/:dir", m.handler((*Manta).handleStorage)) // ListDirectory
mux.DELETE(baseRoute+"/stor/:dir", m.handler((*Manta).handleStorage)) // DeleteDirectory
mux.PUT(baseRoute+"/stor/:dir/:obj", m.handler((*Manta).handleStorage)) // PutObject
mux.GET(baseRoute+"/stor/:dir/:obj", m.handler((*Manta).handleStorage)) // GetObject
mux.DELETE(baseRoute+"/stor/:dir/:obj", m.handler((*Manta).handleStorage)) // DeleteObject
// job APIs
mux.POST(baseRoute+"/jobs", m.handler((*Manta).handleJobs)) // CreateJob
mux.POST(baseRoute+"/jobs/:id/live/in", m.handler((*Manta).handleJobs)) // AddJobInputs
mux.POST(baseRoute+"/jobs/:id/live/in/end", m.handler((*Manta).handleJobs)) // EndJobInput
mux.POST(baseRoute+"/jobs/:id/live/cancel", m.handler((*Manta).handleJobs)) // CancelJob
mux.GET(baseRoute+"/jobs", m.handler((*Manta).handleJobs)) // ListJobs
mux.GET(baseRoute+"/jobs/:id/live/status", m.handler((*Manta).handleJobs)) // GetJob
mux.GET(baseRoute+"/jobs/:id/live/out", m.handler((*Manta).handleJobs)) // GetJobOutput
mux.GET(baseRoute+"/jobs/:id/live/in", m.handler((*Manta).handleJobs)) // GetJobInput
mux.GET(baseRoute+"/jobs/:id/live/fail", m.handler((*Manta).handleJobs)) // GetJobFailures
mux.GET(baseRoute+"/jobs/:id/live/err", m.handler((*Manta).handleJobs)) // GetJobErrors
}
示例12: setup
func setup(router *httprouter.Router) {
router.GET("/api/user", controller.UserGet)
router.GET("/api/user/:id", controller.UserGet)
router.GET("/api/redis/user/:id", controller.RedisUserGet)
router.GET("/api/redis/user", controller.RedisUserGet)
router.PUT("/api/user", controller.UserUpsert)
router.PUT("/api/user/:id", controller.UserUpsert)
router.PUT("/api/redis/user/:id", controller.RedisUserWrite)
router.DELETE("/api/user", controller.UserDelete)
router.DELETE("/api/user/:id", controller.UserDelete)
router.PATCH("/api/user/:id", controller.UserUpdate)
// TOTEC
router.GET("/api/musics", controller.MusicGet)
router.GET("/api/musics/:id", controller.MusicGet)
router.POST("/api/musics", controller.MusicUpsert)
router.PUT("/api/musics/:id", controller.MusicUpsert)
router.DELETE("/api/musics/:id", controller.MusicDelete)
router.POST("/api/musics/:id/play", controller.HistoryUpsert)
}
示例13: RegisterRouter
// RegisterRouter registers a router onto the Server.
func (s *Server) RegisterRouter(router *httprouter.Router) {
router.GET("/ping", s.ping)
router.GET("/customer", s.getCustomers)
router.POST("/customer", s.createCustomer)
router.GET("/customer/:customerID", s.getCustomer)
router.PUT("/customer/:customerID", s.updateCustomer)
router.DELETE("/customer/:customerID", s.deleteCustomer)
router.GET("/product", s.getProducts)
router.POST("/product", s.createProduct)
router.GET("/product/:productID", s.getProduct)
router.PUT("/product/:productID", s.updateProduct)
router.DELETE("/product/:productID", s.deleteProduct)
router.GET("/order", s.getOrders)
router.POST("/order", s.createOrder)
router.GET("/order/:orderID", s.getOrder)
router.PUT("/order/:orderID", s.updateOrder)
router.DELETE("/order/:orderID", s.deleteOrder)
router.POST("/order/:orderID/product", s.addProductToOrder)
}
示例14: setupApi1
// Setup all routes for API v1
func setupApi1(router *httprouter.Router) {
router.GET("/api/v1/*all", APIv1.ApiIndexVersion)
router.POST("/api/v1/*all", APIv1.ApiIndexVersion)
router.PUT("/api/v1/*all", APIv1.ApiIndexVersion)
router.DELETE("/api/v1/*all", APIv1.ApiIndexVersion)
}
示例15: Init
func Init(router *httprouter.Router) {
router.GET("/api/todos", todocontroller.GetAll)
router.POST("/api/todos", todocontroller.NewTodo)
router.DELETE("/api/todos/:id", todocontroller.RemoveTodo)
}