// JoinHandler - Function that handles requests on the index page: "/joinlynx". // @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 JoinHandler(rw http.ResponseWriter, req *http.Request) { req.ParseForm() form = req.Form metapath := form["MetaPath"] err := client.JoinLynk(metapath[0]) if err != nil { // Display meta.info error to user here } IndexHandler(rw, req) }
// Helper function that tests the create functionality of Lynx // @returns nil if successful, error if unsuccessful func testJoin() error { fmt.Println("\n----------------TestJoin----------------") err := client.JoinLynk(mPath) if err != nil { fmt.Println("Test failed, expected no errors. Got " + err.Error()) } else { fmt.Println("Successfully Joined Another Lynk") successful++ } return err }