예제 #1
0
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
0
// 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
0
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
0
파일: routes.go 프로젝트: skmetaly/pbblog
//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
0
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
0
파일: pubsub.go 프로젝트: pengux/pub-sub
// 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
0
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
0
파일: dump.go 프로젝트: janhalfar/dumpster
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
0
파일: auth.go 프로젝트: rezacute/bullettime
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
0
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
0
func (h *Handler) SetRoutes(r *httprouter.Router) {
	r.POST("/keys/:set", h.Create)
	r.PUT("/keys/:set", h.UpdateKeySet)
	r.GET("/keys/:set", h.GetKeySet)
	r.DELETE("/keys/:set", h.DeleteKeySet)

	r.PUT("/keys/:set/:key", h.UpdateKey)
	r.GET("/keys/:set/:key", h.GetKey)
	r.DELETE("/keys/:set/:key", h.DeleteKey)

}
예제 #12
0
// 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)
}
예제 #13
0
파일: mysql.go 프로젝트: falmar/ego
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)
}
예제 #14
0
// 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)
}
예제 #15
0
// 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))
}
예제 #16
0
파일: controller.go 프로젝트: tehleach/hue
//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)
}
예제 #17
0
파일: http.go 프로젝트: SunSparc/cayley
func (api *API) APIv1(r *httprouter.Router) {
	r.POST("/api/v1/query/:query_lang", LogRequest(api.ServeV1Query))
	r.POST("/api/v1/shape/:query_lang", LogRequest(api.ServeV1Shape))
	r.POST("/api/v1/write", LogRequest(api.ServeV1Write))
	r.POST("/api/v1/write/file/nquad", LogRequest(api.ServeV1WriteNQuad))
	//TODO(barakmich): /write/text/nquad, which reads from request.body instead of HTML5 file form?
	r.POST("/api/v1/delete", LogRequest(api.ServeV1Delete))
}
예제 #18
0
func Register(router *httprouter.Router) {
	r := render.New()

	router.POST("/deployments", func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
		deployment := DeploymentFrom(req)
		macaroon := CreateDeploymentMacaroon(deployment)
		RequestApproval(appengine.NewContext(req), deployment, macaroon)

		db := appx.NewDatastore(appengine.NewContext(req))
		if err := db.Save(deployment); err != nil {
			log.Panic(err)
		}

		b, _ := macaroon.MarshalBinary()
		token := base64.URLEncoding.EncodeToString(b)

		r.JSON(w, 200, JSON{
			"token": token,
		})
	})

	router.POST("/validate", func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
		form := &MacaroonForm{}
		json.NewDecoder(req.Body).Decode(form)
		bytes, err := base64.URLEncoding.DecodeString(form.Token)
		if err != nil {
			r.JSON(w, 400, JSON{
				"message": "Error deserializing macaroon.",
				"error":   err.Error(),
			})
			return
		}

		err = VerifyMacaroon(bytes)
		if err != nil {
			r.JSON(w, 400, JSON{
				"message": "Macaroon invalid.",
				"error":   err.Error(),
			})
			return
		}

		r.JSON(w, 200, JSON{
			"message": "Macaroon valid.",
		})
	})
}
예제 #19
0
func Init_UserRoutes(r *httprouter.Router, Debugging bool) {
	r.POST("/newUserDomain", CreateTableUser)
	r.POST("/addUser", CreateUser)
	r.POST("/deleteUser", DropUser)
	r.POST("/getInfoFromUser", QueryUser)
	if Debugging {
		r.GET("/newUserDomain", CreateTableUser)
		r.GET("/addUser", CreateUser)
		r.GET("/deleteUser", DropUser)
		r.GET("/getInfoFromUser", QueryUser)
	}
}
예제 #20
0
func (h *Handler) SetRoutes(r *httprouter.Router) {
	r.GET("/connections", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
		if r.URL.Query().Get("local_subject") != "" {
			h.FindLocal(w, r, ps)
			return
		}

		if r.URL.Query().Get("remote_subject") != "" && r.URL.Query().Get("provider") != "" {
			h.FindRemote(w, r, ps)
			return
		}

		var ctx = context.Background()
		h.H.WriteErrorCode(ctx, w, r, http.StatusBadRequest, errors.New("Pass either [local_subject] or [remote_subject, provider] as query to this request"))
	})

	r.POST("/connections", h.Create)
	r.GET("/connections/:id", h.Get)
	r.DELETE("/connections/:id", h.Delete)
}
예제 #21
0
파일: router.go 프로젝트: kosuda/golang-web
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)
}
예제 #22
0
func Init_RecordRoutes(r *httprouter.Router, Debugging bool) {
	r.POST("/checkLogin", SelectStateFromRecord)
	r.POST("/toggleLogin", ToggleStateFromRecord)
	r.POST("/getAllRecords", SelectAllFromRecord)
	r.POST("/getCurrentRecords", SelectCurrentFromRecord)
	r.POST("/deleteRecords", DropAllFromRecord)
	if Debugging {
		r.GET("/checkLogin", SelectStateFromRecord)
		r.GET("/toggleLogin", ToggleStateFromRecord)
		r.GET("/getAllRecords", SelectAllFromRecord)
		r.GET("/getCurrentRecords", SelectCurrentFromRecord)
		r.GET("/deleteRecords", DropAllFromRecord)
	}
}
예제 #23
0
파일: http.go 프로젝트: imjorge/flynn
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)
}
예제 #24
0
// 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
}
예제 #25
0
// Add routes to http router
// TODO: Add route description parameters and useage
func AddRoutes(router *httprouter.Router) {
	router.ServeFiles("/static/*filepath", http.Dir("./static"))

	router.GET("/", CheckAuth(Index))
	router.GET("/actions", CheckAuth(Actions))
	router.GET("/actions/:ActionId", CheckAuth(ActionById))
	//router.POST("/set/:SetId", PostAction)
	router.GET("/actions/:ActionId/occurrences", Occurrences)
	router.GET("/occurrences/:OccurrenceId", OccurrenceById)

	router.POST("/users", PostUser)
	router.GET("/auth/login", LoginPage)
	router.POST("/auth/login", AuthLogin)

	router.POST("/actions/:ActionId", CheckAuth(PostOccurrence))
	router.POST("/actions/", CheckAuth(PostAction))

	// TODO:
	// router.GET("/sets", sets)
	// router.GET("/sets/:SetId/actions", actionsFromSet)
}
예제 #26
0
// 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)
}
예제 #27
0
파일: http.go 프로젝트: imjorge/flynn
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/discoverd-deregister", h.DiscoverdDeregisterJob)
	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
}
예제 #28
0
func (ctrl *ServicesController) BindActions(router *httprouter.Router) {
	router.GET("/admin/container/services", webapp.MakeAction(webapp.Action{
		RenderTemplate: true,
		TemplatePath:   ctrl.config.Paths.Templates,
		TemplateName:   "view/admin/services/index",
		ActionFunc: func(action *webapp.Action) interface{} {
			return ctrl.model.GetServices()
		},
	}))

	router.GET("/admin/container/services/create", webapp.MakeAction(webapp.Action{
		RenderTemplate: true,
		TemplatePath:   ctrl.config.Paths.Forms,
		TemplateName:   "edit",
		ActionFunc: func(action *webapp.Action) interface{} {
			form := new(forms.Form)
			form.CreateFromMeta(model.Service{}.GetForm())
			form.SetTemplatesPath(ctrl.config.Paths.Forms + "edit")

			return map[string]interface{}{
				"form": form,
			}
		},
	}))

	router.POST("/admin/container/services/create", webapp.MakeAction(webapp.Action{
		RenderTemplate: true,
		TemplatePath:   ctrl.config.Paths.Forms,
		TemplateName:   "edit",
		ActionFunc: func(action *webapp.Action) interface{} {
			item := model.Service{}
			form := new(forms.Form)
			form.CreateFromMeta(item.GetForm())
			form.SetTemplatesPath(ctrl.config.Paths.Forms + "edit")

			if form.IsValid(action.Request) {
				item.SetValues(form.GetValues())
				ctrl.model.Create(item)
			}

			action.Redirect("/admin/container/services")
			return nil
		},
	}))

	router.GET("/admin/container/services/update/:id", webapp.MakeAction(webapp.Action{
		RenderTemplate: true,
		TemplatePath:   ctrl.config.Paths.Forms,
		TemplateName:   "edit",
		ActionFunc: func(action *webapp.Action) interface{} {
			item := ctrl.model.GetItemById(action.Params.ByName("id"))
			form := new(forms.Form)
			form.CreateFromMeta(item.GetForm())
			form.SetTemplatesPath(ctrl.config.Paths.Forms + "edit/")

			return map[string]interface{}{
				"form": form,
			}
		},
	}))

	router.POST("/admin/container/services/update/:id", webapp.MakeAction(webapp.Action{
		RenderTemplate: true,
		TemplatePath:   ctrl.config.Paths.Forms,
		TemplateName:   "edit",
		ActionFunc: func(action *webapp.Action) interface{} {
			item := ctrl.model.GetItemById(action.Params.ByName("id"))
			form := new(forms.Form)
			form.CreateFromMeta(item.GetForm())
			form.SetTemplatesPath(ctrl.config.Paths.Forms + "edit/")

			if form.IsValid(action.Request) {
				item.SetValues(form.GetValues())
				ctrl.model.Update(*item)
			}

			action.Redirect("/admin/container/services")
			return nil
		},
	}))

	router.GET("/admin/container/services/delete/:id", webapp.MakeAction(webapp.Action{
		RenderTemplate: true,
		TemplatePath:   ctrl.config.Paths.Forms,
		TemplateName:   "edit",
		ActionFunc: func(action *webapp.Action) interface{} {
			ctrl.model.Delete(action.Params.ByName("id"))
			action.Redirect("/admin/container/services")
			return nil
		},
	}))
}
예제 #29
0
func Init(router *httprouter.Router) {
	router.GET("/api/todos", todocontroller.GetAll)
	router.POST("/api/todos", todocontroller.NewTodo)
	router.DELETE("/api/todos/:id", todocontroller.RemoveTodo)
}
예제 #30
0
// 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)
}