Example #1
0
//Start - setup the project manager route
func (proj ProjectManagerRoute) Start(router *mux.Router, apiCallMap interfaces.APICalls) {
	proj.Save = interfaces.NewAPICall(
		"ProjectManagerSave",
		[]string{"POST", "PUT"},
		"/project/save",
		proj.saveHandler,
		"Takes a Project and saves it to the store",
		"Nothing right now",
	)

	proj.Delete = interfaces.NewAPICall(
		"ProjectManagerDelete",
		[]string{"DELETE"},
		"/project/delete/{project_id}",
		proj.deleteHandler,
		"Deletes a given project id",
		"Project id (integer)",
	)

	proj.Get = interfaces.NewAPICall(
		"ProjectManagerGet",
		[]string{"GET"},
		"/project/get/{project_id}",
		proj.getHandler,
		"Get the details of a project given a project id",
		"project id (integer)",
	)

	proj.List = interfaces.NewAPICall(
		"ProjectManagerList",
		[]string{"GET"},
		"/project/get",
		proj.listHandler,
		"List all projects",
		"None",
	)

	proj.Get.Register(router)
	apiCallMap[proj.Get.Name] = proj.Get

	proj.List.Register(router)
	apiCallMap[proj.List.Name] = proj.List

	proj.Delete.Register(router)
	apiCallMap[proj.Delete.Name] = proj.Delete

	proj.Save.Register(router)
	apiCallMap[proj.Save.Name] = proj.Save
}
Example #2
0
//Start - Inits the test method, makes it work
func (test TestRoute) Start(rtr *mux.Router, apiCallMap interfaces.APICalls) {
	test.Call = interfaces.NewAPICall(
		"Test",
		[]string{"GET", "POST"},
		"/test",
		HandleTest,
		"I'm a test method, no one cares",
		"There are no methods",
	)
	test.Call.Register(rtr)
	apiCallMap[test.Call.Name] = test.Call
}
Example #3
0
//Start - Setsup the route object
func (idx IndexRoute) Start(router *mux.Router, apiCallMap interfaces.APICalls) {
	log.Println("Starting Index Route")

	idx.Call = interfaces.NewAPICall(
		"Index",
		[]string{"GET", "POST"},
		"/",
		idx.handleIndex,
		"Returns the List of all active routes",
		"None",
	)

	apiCallsRef = apiCallMap

	idx.Call.Register(router)
	apiCallMap[idx.Call.Name] = idx.Call

}