package Friends import ( "encoding/json" "net/http" "git.tovijaeschke.xyz/tovi/Envelope/Backend/Models" "git.tovijaeschke.xyz/tovi/Envelope/Backend/Util" ) func Friend(w http.ResponseWriter, r *http.Request) { var ( userData Models.User returnJson []byte err error ) userData, err = Util.GetUserById(w, r) if err != nil { http.Error(w, "Not Found", http.StatusNotFound) return } returnJson, err = json.MarshalIndent(userData, "", " ") if err != nil { http.Error(w, "Error", http.StatusInternalServerError) return } w.WriteHeader(http.StatusOK) w.Write(returnJson) }