Learning GraphQL from a Video
Learning GraphQL from a Video
I tried to do this without a blog post and I failed. Look. It's HARD having such a unique learning style. It's harder still trying to explain it to people. GraphQL is a way to use existing tools. With Rest API, you might have to hit multiple endpoints. You might have to re-hit endpoints with multiple parameters based on information you get back from prior queries.
You might get far more information than you need. GraphQL from what I understand allows you to just hit one endpoint to get the information you need. And you can specify different parameters and things that you want etc. All to get back exactly what you want. This feels very magical. Very magical indeed. Right.
So this is the video I am watching:
It will of course take me much longer than 40 minutes to watch this - and that is okay. I learn slower, but I learn thoroughly. So this video has an example.
The example
In the example, we have to build an app. We have two inputs - authors and books.
Each one has lots and lots of information.
The thing is for each of these we only want to display one thing - names.
So we want to get each of the authors - and only their names. And then we want to get each of the books by author - and only their name too. Doing this with Rest API from the API is a long and painful process. But I have just got to the bit where he shows how to do it with GraphQL. Thanks.
With GraphQL, you compose a query, of exactly the data that you want
"WITH GRAPHQL, YOU COMPOSE A QUERY, OF EXACTLY THE DATA THAT YOU WANT." With Graph QL you compose a query of exactly the data that you want - thank you
Oh man
Okay so - you write your query in such a way that you say - this is what I want: I want to query authors -> and I just want the names. And then for every author -> I want to query books -> and then I just want the names. And YOU WILL GET THIS BACK. And NOTHING ELSE
You will get ONLY THE INFORMATION THAT YOU ASKED FOR
And you can get AS MUCH INFORMATION AS YOU WANT. Or AS LITTLE INFORMATION AS YOU WANT. THANKS
A Leonard Cohen Afterward
I have to leave it there for now. I don't know whether to continue with the video or not. I have been coding along. I will ask my mentor. I was going to read some docs. I ran out of time but I can read them later
I love my life so so much
I am so lucky
and thank you <3 ❤️❤️❤️
.png)
Comments
Post a Comment