func CheckUserExists(w http.ResponseWriter, req *http.Request) { req.ParseForm() uname := req.FormValue("user_name") phone := req.FormValue("phone") email := req.FormValue("email") exists, err := serv.CheckUserExists(uname, phone, email) if err != nil { seelog.Errorf("error register %v", err) http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) } else { w.Write(pgpub.CreateQueryJson(exists)) } }
func ShowTeachers(w http.ResponseWriter, req *http.Request) { req.ParseForm() ok, err := serv.CheckToken(req.FormValue("token")) if err != nil { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } else if !ok { http.Error(w, http.StatusText(http.StatusForbidden), http.StatusForbidden) return } teachers, err := serv.ShowTeachers() if err != nil { http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) return } w.Write(pgpub.CreateQueryJson(teachers)) }