// CreateHandler - Function that handles requests on the index page: "/createlynx". // @param http.ResponseWriter rw - This is what we use to write our html back to // the web page. // @param *http.Request req - This is the http request sent to the server. func CreateHandler(rw http.ResponseWriter, req *http.Request) { req.ParseForm() form = req.Form name := form["Name"] client.CreateMeta(name[0]) tracker.CreateSwarm(name[0]) IndexHandler(rw, req) }
// Helper function that tests the create functionality of Lynx // @returns nil if successful, error if unsuccessful func testCreate() error { fmt.Println("----------------TestCreate----------------") err := client.CreateMeta("SysTests") tracker.CreateSwarm("SysTests") if err != nil { fmt.Println("Test failed, expected no errors. Got " + err.Error()) } else { fmt.Println("Successfully Created Lynk") successful++ } return err }