GraphQL vs REST: what you need to know

  Рет қаралды 14,596

Kodaps Academy

Kodaps Academy

Жыл бұрын

It's time to explore together the wonderful world of GraphQL and REST. Let's take a look at what GraphQL is, what REST is, and when you should choose one over the other.
What is the need they exist to serve?
Why and how to use them?
And we'll see the four advantages GraphQL has over the REST-full style of APIs.
And then the 2 major disadvantages that you have to watch out for if you use or create an API in GraphQL.
But before that, let's start at the beginning:
What is GraphQL?
GraphQL is a way to create web APIs. I've already made a video talking about APIs in general, and REST web APIs in particular.
REST is the standard way to organise an API. But GraphQL is challenging that position of dominance.
To understand GraphQL, and to understand why it exists, I will be comparing it with the way REST APIs are organised. Because GraphQL is in part a response to the problems that REST has.

Пікірлер: 56
@goldenboy_808
@goldenboy_808 Жыл бұрын
This is a wonderful video. For months I’ve been using a GraphQL API but I never took a step back to determine WHY I was using it and the advantages of using it over REST API
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Glad to have been of service :)
@linonator
@linonator Жыл бұрын
Definitely a useful video ! Happy I watched this, very clear and concise with no fluf
@philipfwilson
@philipfwilson Жыл бұрын
Very good clean, quick video.. thanks for the refresh
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Glad to be of service :)
@Warley226
@Warley226 Жыл бұрын
I'm Brazilian and I thought the video was fantastic, congratulations.
@KodapsAcademy
@KodapsAcademy Жыл бұрын
I’m glad you liked it, thanks for the kind words :)
@nomad7317
@nomad7317 6 ай бұрын
By far, the best video about GraphQL! Thanks a ton!!
@annbui6900
@annbui6900 Жыл бұрын
Love the details info you provided!!! Keep up with the great work💪🏻
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Thanks for the kind words, Ann!
@hakberdiorazow232
@hakberdiorazow232 Жыл бұрын
This is channel is underrated
@jefvanderavoirt7363
@jefvanderavoirt7363 Жыл бұрын
Only 2.9K views? Great video, thanks!
@IasonOrlandosOx
@IasonOrlandosOx Жыл бұрын
Thanks ! very clear and informative
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Glad you liked it :)
@drownwave1150
@drownwave1150 Жыл бұрын
Your channel deserves more views.
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Thanks :)
@MegaWurzelpeter
@MegaWurzelpeter 9 ай бұрын
Nice and compact comparison.
@KodapsAcademy
@KodapsAcademy 8 ай бұрын
Thanks :)
@gauninha12
@gauninha12 Жыл бұрын
Great lesson from Mr. Robot himself hehehe Thanks!
@stefan5083
@stefan5083 6 ай бұрын
Very interesting video! A small remark: the sound attached in the explanations (I don't have a term) is a little too loud in tune with the voice. Otherwise... I hope the result is worth the effort :)
@sasanlotfi9828
@sasanlotfi9828 8 ай бұрын
Amazing explanation!
@KodapsAcademy
@KodapsAcademy 8 ай бұрын
Thanks :)
@my-curiosity
@my-curiosity Жыл бұрын
great video!
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Thanks:)
@raheemamer9261
@raheemamer9261 Жыл бұрын
Lovely, thank you
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Glad you liked it :)
@lydstyl
@lydstyl Жыл бұрын
Merci pour tes vidéos de qualité ! Je pense qu'il y a un autre inconvenient à GraphQL : on est, sauf erreur de ma part, obligé (ou presque) d'utiliser une librairie en backend et aussi en frontend comme par exemple Apollo server et Apollo Client. Cela rend moins accessible l'API et rend la maintenance plus compliqué sur le long run (mise à jour d'Apollo par exemple).
@KodapsAcademy
@KodapsAcademy Жыл бұрын
ET merci pour le compliment :) C'est fortement recommandé côté serveur de passer par une lib, effectivement. Côté client ce n'est pas forcément nécessaire mais ça simplifie la vie :)
@lydstyl
@lydstyl Жыл бұрын
@@KodapsAcademy Top ! Je pense bientot faire une API GraphQl pour me permettre de gérer la composition d'un portefeuille d'actifs (actions, cryptos, immobilier, etc.) donc d'après ta réponse je devrais pouvoir consommer l'API en vanilla JS sans trop de difficultés par exemple dans un script macro si je veux utiliser le tableur Google Calc. Du coup, si c'est le cas, je ne trouve plus trop d'interet à la classique API REST.
@KodapsAcademy
@KodapsAcademy Жыл бұрын
J'ai déjà fait des appels à une API GraphQL avec du Lua, donc avec du JS Vanilla ça peut le faire sans problème, il suffit de faire un POST sur le point d'entrée qui va bien (genre /graphql ) en envoyant en body de ta requête (HTTP) la requête GraphQL que tu veux lancer
@darz_k.
@darz_k. Жыл бұрын
Very well done - subbed ;o,
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Thanks, welcome aboard :)
@darz_k.
@darz_k. Жыл бұрын
@@KodapsAcademy Merci 😁
@KodapsAcademy
@KodapsAcademy Жыл бұрын
bien vu ;)
@manofculture8666
@manofculture8666 6 ай бұрын
Just trying to really understand GraphQL's benefits. Can't you use REST to do exactly what GraphQL does? Doesn't that just depend on how you've built the API? I can build a /user endpoint that takes the required columns as a parameters, and returns only the needed columns and relationships. Not sure what GraphQL does that REST can't aside extra documentation. Could someone explain?
@KodapsAcademy
@KodapsAcademy 6 ай бұрын
In your example, the server (statically) decides which fields to send via the rest API, based on how it is build. In GraphQL the client defines the fields it needs and requests them, which can result in smaller network payloads.
@manofculture8666
@manofculture8666 6 ай бұрын
@@KodapsAcademy But the client can decide what fields it needs. All I have to do is make the endpoint take, say, a "fields" parameter, and put that in whatever SELECT functionality the backend is using to fetch the data. Then the server will only return the needed data. The server doesn't have to return everything.
@alexvass
@alexvass Ай бұрын
Thanks
@KodapsAcademy
@KodapsAcademy Ай бұрын
Thank you !
@caerulemusic
@caerulemusic Жыл бұрын
hey dude just some constructive criticism - i think the sound effect volume is too high in the mix. it's distracting. thanks for the vid!
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Thanks for the feedback, it's always welcome, and I'm sorry that the video was not quite up to par :)
@awakeupcall5336
@awakeupcall5336 Жыл бұрын
nice
@rodrigofrancescani4223
@rodrigofrancescani4223 Жыл бұрын
I somehow like your energy
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Thanks :)
@MegaBaellchen
@MegaBaellchen Жыл бұрын
OpenApi is the defacto standard for rest api documentation
@KodapsAcademy
@KodapsAcademy Жыл бұрын
I know, I’ve used it as swagger. But documentation is built into the protocol and is discoverable in GQL, which makes for better tooling.
@mirzasisic
@mirzasisic Жыл бұрын
All right, here's the signal for KZbin's algorithm.
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Thanks :)
@dxhelios7902
@dxhelios7902 9 ай бұрын
@Kodaps Really? Let me count mistakes: 1. REST and RESTful API and REST web APIs are different things 2. "where each row represents an object" - why? who decided this? you? Somehow you went from API approach to ORM? And the only way to do ORM is object-row mapping in your context. That is not actually the case. 3. And you say it loudly REPRESENTATIONAL state transfer. You transfer REPRESENTATION, not the whole state, because, where there are relations, state also includes relations. It is just logic. 4. REST purpose is not to communicate items, its purpose is to communicate representation of the state of an object. Why you need to add some flavor to interpretation? 5. Why I should care about relationships if I sometimes care just about property in the state of the object? You present it like it always important to work with relationships. IMHO in mutation scenarios, relationships are less important than just mutating the state of a known object (which ID is already known). I do not need to navigate through relations to update state at all! The thing that you present as advantage are virtual and it is not always important and can be easily covered by REST API and sufficient API management 6. "We define response shape on a client". This was solved years ago with OData and OData is a standard for REST. Yes, you can define the shape of the response. 7. Strong typing is viable as much as tooling supports it. For REST APIs we have strong tooling, for GraphQL it is missing. So overall I do not see any significant advantage of GraphQL. In some teams differences may play positive role, in others they will make no difference, in others they may introduce unnecessary bottlenecks. I do not see GraphQL as viable alternative to simple RESTful API with API management.
@KodapsAcademy
@KodapsAcademy 9 ай бұрын
I didn't realise GraphQL and REST could evoke such an emotional response :D
@miraclehesed8959
@miraclehesed8959 8 ай бұрын
@dxhelios7002. Restful API's is to REST as communication is to communicate. When he made that point, he made it generalizing To API that uses REST protocols in which REST in it's own falls into that category. But I think you're right.
@laas29
@laas29 9 ай бұрын
graphql + apollo = wasted time
@KodapsAcademy
@KodapsAcademy 9 ай бұрын
Feel free to add some substance to your contribution, e.g. what makes you say so, how do you propose to cache GraphQL requests other than via Apollo, etc. :)
@miraclehesed8959
@miraclehesed8959 8 ай бұрын
Yes @laas29 why did you say that. Please elaborate more. We need your response.
@igboanugwocollins4452
@igboanugwocollins4452 Жыл бұрын
I like your teaching... You just got a subscriber
@KodapsAcademy
@KodapsAcademy Жыл бұрын
Glad you liked it and that I was able to be helpful :)
GraphQL vs REST: What's The Difference And When To Use Which?
26:57
Comparing web API types: SOAP, REST, GraphQL and RPC
15:19
AltexSoft
Рет қаралды 90 М.
Normal vs Smokers !! 😱😱😱
00:12
Tibo InShape
Рет қаралды 119 МЛН
MOM TURNED THE NOODLES PINK😱
00:31
JULI_PROETO
Рет қаралды 9 МЛН
格斗裁判暴力执法!#fighting #shorts
00:15
武林之巅
Рет қаралды 88 МЛН
I Need Your Help..
00:33
Stokes Twins
Рет қаралды 139 МЛН
Why I Don’t Use GraphQL Anymore
16:29
Harry Wolff
Рет қаралды 69 М.
REST vs GraphQL | When to choose one over other | Tech Primers
19:42
Unique Go Keywords: What Makes Golang Stand Out
4:01
gql.tada makes me miss GraphQL…
13:57
Theo - t3․gg
Рет қаралды 34 М.
React vs HTMX: Why we chose HTMX?
5:01
Kodaps Academy
Рет қаралды 3,4 М.
Stop Making These 5 GraphQL Mistakes
8:59
TomDoesTech
Рет қаралды 2,4 М.
Why does Zig pay more?
6:44
Kodaps Academy
Рет қаралды 6 М.
Why learn LUA?
6:24
Kodaps Academy
Рет қаралды 4,1 М.
Top 7 Ways to 10x Your API Performance
6:05
ByteByteGo
Рет қаралды 304 М.
3D printed Nintendo Switch Game Carousel
0:14
Bambu Lab
Рет қаралды 4,7 МЛН
The power button can never be pressed!!
0:57
Maker Y
Рет қаралды 54 МЛН
Куда пропал 3D Touch? #apple #iphone
0:51
Не шарю!
Рет қаралды 666 М.
Huawei который почти как iPhone
0:53
Romancev768
Рет қаралды 537 М.
wyłącznik
0:50
Panele Fotowoltaiczne
Рет қаралды 23 МЛН