func UsersHandler(w http.ResponseWriter, r *http.Request) { defer errors.RecoverHttpErr(w) err := store.CheckAuth(r) errors.CheckHttpErr(err != nil, "Unauthorized", 401) switch r.Method { case "GET": usersGet(w, r) default: http.Error(w, "Bad Request", 400) } }
func OrganizationHandler(w http.ResponseWriter, r *http.Request) { defer errors.RecoverHttpErr(w) err := store.CheckAuth(r) errors.CheckHttpErr(err != nil, "Unauthorized", 401) switch r.Method { case "GET": organizationGet(w, r) case "POST": organizationPost(w, r) case "PUT": organizationPut(w, r) case "DELETE": organizationDelete(w, r) default: http.Error(w, "Bad Request", 400) } }