Confused about Node Client

Dear community,
I’m generally confused about the use of the Node API client. I can’t figure out how to get the correct data in JSON format.

I made a Node Express service which requests the data from the Asana API

function createClient() {
  return Asana.Client.create().useAccessToken(process.env.PAT)
}
app.get("/projects", (req, res) => {
  console.log("asana/projects")
  var client = createClient()

  res.setHeader("Access-Control-Allow-Origin", "http://localhost:3000")
  res.setHeader("Content-Type", "application/json")

  var projects = client.projects

  console.log("var projects: ", projects)

  client.projects
    .findAll()
    .then((response) => {
      console.log("projects response: ", response)
      response.data
    })
    .then((result) => {
      console.log("/projects : ", result)
      res.end(JSON.stringify(result))
    })
    .catch((err) => {
      console.log("/projects err: ", err)
      res.end("Error fetching projects: " + err)
    })
})

I’ve tried several things in regards to client.projects methods. The docs use the example:

client.projects.getProjects({param: "value", param: "value", opt_pretty: true})
    .then((result) => {
        console.log(result);
    });

But the getProjects() is not a method distributed by the client.

My webservice request the Node service with the following method:

export function getProjects(): Promise<null | Project[]> {
  var request: Promise<null | Project[]> = fetch(URL + "projects", GET_HEADER())
    .then((response) => {
      if (response.ok) {
        console.log("getProjects response ok: ", response)
        console.log("getProjects response.json(): ", response)
        return response.json()
      } else {
        throw new Error("Something went wrong")
      }
    })
    .then((data) => {
      console.log("getProjects data: ", data)

      var result: Project[] = data.map((el: Project) => {
        var project: Project = {
          gid: el.gid,
          name: el.name,
          resource_type: el.resource_type,
        }

        return project
      })

      console.log("getProjects result: ", result)
      return result
    })
    .catch((err) => {
      console.log("getProjects error: ", err)
      return null
    })

  return request
}

Sorry for the console.logs(), been trying to debug this for some time now.

The response is the following:

  1. Response {type: “basic”, url: “http://localhost/api/asana/users”, redirected: false, status: 200, ok: true, …}

  2. body: (…)

  3. bodyUsed: true

  4. headers: Headers {}

  5. ok: true

  6. redirected: false

  7. status: 200

  8. statusText: “OK”

  9. type: “basic”

  10. url: “http://localhost/api/asana/users
    but how do I get the users JSON list?