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


Golang Router.DELETE方法代码示例

本文整理汇总了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)
}
开发者ID:MarvinMenzerath,项目名称:UpAndRunning2,代码行数:27,代码来源:main.go

示例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
}
开发者ID:pengux,项目名称:pub-sub,代码行数:9,代码来源:pubsub.go

示例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")
}
开发者ID:ello,项目名称:streams,代码行数:8,代码来源:stream_controller.go

示例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)
}
开发者ID:janhalfar,项目名称:dumpster,代码行数:9,代码来源:dump.go

示例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))
}
开发者ID:teefax,项目名称:tmail,代码行数:11,代码来源:handlers_queue.go

示例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)
}
开发者ID:robertocs,项目名称:cepiot,代码行数:10,代码来源:rule_controller.go

示例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)
}
开发者ID:imjorge,项目名称:flynn,代码行数:12,代码来源:http.go

示例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))
}
开发者ID:ro78,项目名称:tmail,代码行数:14,代码来源:handlers_users.go

示例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)
}
开发者ID:adventure-awaits,项目名称:api,代码行数:14,代码来源:routes.go

示例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
}
开发者ID:ably-forks,项目名称:flynn,代码行数:16,代码来源:http.go

示例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
}
开发者ID:joyent,项目名称:gomanta,代码行数:43,代码来源:service_http.go

示例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)
}
开发者ID:kosuda,项目名称:golang-web,代码行数:21,代码来源:router.go

示例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)
}
开发者ID:cockroachdb,项目名称:examples-orms,代码行数:23,代码来源:server.go

示例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)
}
开发者ID:MarvinMenzerath,项目名称:UpAndRunning2,代码行数:7,代码来源:main.go

示例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)
}
开发者ID:lwzjf,项目名称:generator-ng-fullstack,代码行数:5,代码来源:todoroutes.go


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