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


Golang Router.Put方法代碼示例

本文整理匯總了Golang中github.com/go-martini/martini.Router.Put方法的典型用法代碼示例。如果您正苦於以下問題:Golang Router.Put方法的具體用法?Golang Router.Put怎麽用?Golang Router.Put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/go-martini/martini.Router的用法示例。


在下文中一共展示了Router.Put方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Register

func (tr *TaskRouter) Register(r martini.Router) {
	r.Get("", tr.GetAllTasks)
	r.Post("", tr.CreateTask)
	r.Get("/:id", tr.GetTask)
	r.Put("/:id", tr.CreateTask)
	r.Delete("/:id", tr.CancelTask)
}
開發者ID:froz,項目名稱:app-scheduler,代碼行數:7,代碼來源:task.go

示例2: setup

func setup(router martini.Router) {
	router.Get("/user/:id", controllers.UserGet)

	router.Put("/user/:id",
		binding.Json(models.User{}),
		binding.ErrorHandler,
		controllers.UserPut)
}
開發者ID:kosuda,項目名稱:martini-test,代碼行數:8,代碼來源:router.go

示例3: Register

func (lr *SiteRouter) Register(r martini.Router) {

	r.Get("", lr.GetAll)
	r.Get("/:id", lr.GetSite)
	r.Put("/:id", lr.PutSite)
	r.Delete("/:id", lr.DeleteSite)

}
開發者ID:kpernyer,項目名稱:sphere-go-homecloud,代碼行數:8,代碼來源:site.go

示例4: Register

func (lr *ThingRouter) Register(r martini.Router) {

	r.Get("", lr.GetAll)
	r.Get("/:id", lr.GetThing)
	r.Put("/:id", lr.PutThing)
	r.Put("/:id/location", lr.PutThingLocation)
	r.Delete("/:id", lr.DeleteThing)

}
開發者ID:kpernyer,項目名稱:sphere-go-homecloud,代碼行數:9,代碼來源:thing.go

示例5: Register

func (lr *RoomRouter) Register(r martini.Router) {

	r.Get("", lr.GetAll)
	r.Post("", lr.PostNewRoom)
	r.Get("/:id", lr.GetRoom)
	r.Delete("/:id", lr.DeleteRoom)
	r.Put("/:id", lr.UpdateRoom)
	// r.Get("/:id/things", lr.GetThings) Not sure if this was used
	r.Put("/:id/calibrate", lr.PutCalibrateRoom)
	r.Put("/:id/apps/:appName", lr.PutAppRoomMessage)

}
開發者ID:kpernyer,項目名稱:sphere-go-homecloud,代碼行數:12,代碼來源:room.go

示例6: SetRoutes

func (this *EurekaRequestPut) SetRoutes(r martini.Router) {
	r.Put("/apps/:appId/:instanceId", this.requestHeartBeat)
}
開發者ID:ArthurHlt,項目名稱:microcos,代碼行數:3,代碼來源:eureka_request_put.go

示例7: SetupTodoRoutes

func SetupTodoRoutes(r martini.Router) {
	r.Get("/todos", ListTodos)
	r.Post("/todos", binding.Json(Todo{}), CreateTodo)
	r.Put("/todos", binding.Json(Todo{}), UpdateTodo)
}
開發者ID:newsquid,項目名稱:newsquidtest,代碼行數:5,代碼來源:todo.go

示例8: BindRoutes

// BindRoutes binds API routes.
func BindRoutes(r martini.Router) {

	r.NotFound(func(req *http.Request, r render.Render) {
		r.JSON(http.StatusNotFound, []string{"The requested url does not exists."})
	})

	r.Get("/api/status", Status)

	// Registration
	r.Group("/api", func(r martini.Router) {
		r.Group("/accounts", func(r martini.Router) {
			r.Post("/register", binding.Bind(accounts.RegisterViewModel{}), NotificatorHandler(), accounts.Register)
		})
	}, GatekeeperRouteHandler())

	// DASHBOARD GATEKEEPER
	r.Group("/api", func(r martini.Router) {
		r.Group("/auth", func(r martini.Router) {
			r.Post("/password", binding.Bind(auth.PasswordRequest{}), auth.Password)
		})
	}, GatekeeperRouteHandler(), AccountScopeHandler(), RepositoryScopeHandler())

	//ADMIN
	r.Group("/api", func(r martini.Router) {
		r.Get("/accounts", accounts.Index)
		r.Post("/accounts", binding.Bind(accounts.AccountViewModel{}), accounts.Post)
		r.Delete("/:id", accounts.Delete)
	}, AdminRouteHandler())

	//Owner / Manager
	r.Group("/api", func(r martini.Router) {
		r.Group("/accounts", func(r martini.Router) {
			r.Get("/:id", accounts.Get)
			r.Put("/:id", binding.Bind(accounts.AccountViewModel{}), accounts.Put)
		})

		r.Get("/devices", devices.Index)
		r.Post("/devices", binding.Bind(devices.DeviceViewModel{}), devices.Post)
		r.Group("/devices", func(r martini.Router) {
			r.Get("/:id", devices.Get)
			r.Put("/:id", binding.Bind(devices.DeviceViewModel{}), devices.Put)
			r.Post("/register", binding.Bind(devices.DeviceViewModel{}), devices.Post)
			r.Delete("/:id", devices.Delete)
		})

		r.Get("/doors", doors.Index)
		r.Post("/doors", binding.Bind(doors.DoorViewModel{}), doors.Post)
		r.Group("/doors", func(r martini.Router) {
			r.Get("/:id", doors.Get)
			r.Put("/:id", binding.Bind(doors.DoorViewModel{}), doors.Put)
			r.Delete("/:id", doors.Delete)
		})

		r.Post("/people", binding.Bind(people.PersonViewModel{}), people.Post)
		r.Group("/people", func(r martini.Router) {
			r.Post("/sync", BridgeHandler(), people.Sync)
			r.Delete("/:id", people.Delete)
		})

	}, AccountScopeHandler(), RepositoryScopeHandler(), SecuredRouteHandler(), ManagerRestrictedRouteHandler())

	//Account
	r.Group("/api", func(r martini.Router) {
		r.Group("/accounts", func(r martini.Router) {
			r.Get("/:id", accounts.Get)
		})

		r.Post("/notifications", NotificatorHandler(), binding.Bind(notifications.ViewModel{}), notifications.Notify)

		r.Get("/people", people.Index)
		r.Group("/people", func(r martini.Router) {
			r.Get("/:id", people.Get)
			r.Put("/:id", binding.Bind(people.PersonViewModel{}), people.Put)
		})

	}, AccountScopeHandler(), RepositoryScopeHandler(), SecuredRouteHandler())
}
開發者ID:masom,項目名稱:doorbot,代碼行數:78,代碼來源:routes.go


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