frankcollins3 / Next-Water-App

Happy, Healthy Water Cycling App that tracks user/human fluid intake.
https://next-water-app.vercel.app
1 stars 0 forks source link

Sandbox Studio GraphQL [5:08pm] #25

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

attempting to do: play in the sandbox until it's time to swim in the water

error: Screen Shot 2023-07-10 at 5 07 15 PM

proposed approach: dig around with endpoints. Also the link is an array of object data. doesn't hurt to start a little smaller like a simple string query

frankcollins3 commented 1 year ago

I was gonna say it's kind of confusing that the query has to be: query links { links { id } }

👍 ? but I think I understand. links is the query and the second object is the resolver. 👎 ?

I didn't find this out on my own I clicked the ( + ) links [ Link]! button which is by Fields in the Left hand side "Documentation" part of the apollo sandbox.

Screen Shot 2023-07-10 at 5 26 56 PM

[5:29pm]

frankcollins3 commented 1 year ago

dont need to open up a new issue for this. GraphQL feels redundant in 2 similar ways.

in the sandbox

**query pokemon {
  pokemon {**
    name,
    id
  }
}

Screen Shot 2023-07-10 at 10 07 54 PM

but in the clientside fetch, the word query is used back to back. Seemingly like the word "pokemon" is used in sandbox

  try {
    const response = await axios.post('/api/graphql', {
      **query: `
        query {**
          pokemon {
            name
          }
        }
      `,

Screen Shot 2023-07-10 at 10 08 11 PM

// note this isn't a pokemon app just testing the moving of an HTTP endpoint from the graphql server

[10:11pm]