GraphQL Crash Course
Vložit
- čas přidán 19. 09. 2019
- 💻 More software engineering videos • Software Engineering b...
GraphQL Pros and Cons, examples and when to use over REST
GraphQL is an open source query language developed by facebook that allows clients to formulate queries to get different results. Its main goal is to combine multiple services into one endpoint. In this video we will discuss what is GraphQL, why facebook developed it, go through some examples using github GraphQL API, finally we will discuss the pros and cons and when you should use this technology.
- What is GraphQL?
- Examples
- Pros and Cons
- when to use REST vs GRAPHQL
What is GraphQL
- Schema
- Query language
- Nesting
- Mutation and subscription
Examples
Schema intro
Github API
Rest api
Pros
- Flexibility
- efficient response : payload back only get what you want of fields since you know the schema
- No round trips- Avoiding multiple round trips (HATEOS REST)
- Uniform single interface API endpoint
- Self documenting
Cons
- Complexity
- Typed system - ( use it to know if a type is available or not and fork logic) slows down adoption.. same as soap
- No Caching etag since always POST
- Error management non-standard for HTTP.
- Over engineering can lead to Inefficiency of the joins can lead to performance and DOS
developer.github.com/v4/guide...
WHEN TO USE GRAPHQL
Public ad-hoc API that you can’t predict how it will be used
Specific and well-design use cases API
Simple API that serves one client (webpage)
Enterprise API (new york times)
Well defined schema
Without the need of performing multiple round trips. It as a reaction to certain limitations of the REST API.
Schema
all post
except schema call get
via fetch api
Source Code for RESTAPI vs GraphQL
github.com/hnasr/javascript_p...
Jump Codes
2:30 What is GraphQL?
13:50 Properties of GraphQL
18:00 Examples
34:00 Pros and Cons
47:10 When to use GraphQL over REST
Cards
4:00 REST API
31:20 GIT HUB REST API
33:00 Caddy Web Server
43:55 GET VS POST
Support me on PayPal bit.ly/33ENps4
Become A Patron / hnasr
Stay Awesome!
Hussein - Věda a technologie
Time Codes
2:30 What is GraphQL?
13:50 Properties of GraphQL
18:00 Examples
34:00 Pros and Cons
47:10 When to use GraphQL over REST
The guy really enjoys teaching! Such a cool one.
The way you explain, makes all the difference. Thanks for all the wonderful tutorials and for many more to come. God Bless you! :)
Suhas C thanks Suhas! Glad you found the videos useful, stay awesome!
Honestly, I love your videos, Thanks Hussein! No other videos actually make me smile while I listen
Hey man, amazing video, I'm actually developing an app for shopify, and since their apis use graphql, I had to learn it, best tutorial by far, simple and clear, keep doing ya thing!
Thank you Mateo! All the best. On your app 🙏
Ok, after endless procrastination, I finally got to this :D Thank you!!!
Loving your style of explaining! 🙏🏾
A great starting point to learn GraphQL to learn it in depth.
hussein: don't get attached to anything,
Me, already attached to this channel, watching backend things
Really good eplanation at the start about what makes GraphQL different from REST and a good option
Hi Hussien Nasser sir, your channel is something special to me.
Mostly I do blind code but now I watch your videos to understand basics. Now I able to connect with what I doing .
I am interested in-sourcing with graphQL.
Thank you Kamaraj!! Happy you find content useful
استاذ حسين كل الحب زادك الله علما ونفعا به
Expensive queries con can be solved by persisted queries - client sends query id and server associates it with corresponding query. This way client sends only persisted query id and query variables (if any). Awesome explanation of GraphQL, thank you very much ❤
Well understood. Both REST and GraphQL are great technologies, depending on what your client request types are. Thank you
Very cool video. But I would like to add that GQL not only brings everything to 1 endpoint (well, not actually but close). It also acts as abstraction layer that IMHO is easier to understand then REST
Thank you so much Hussein, I love your videos and your explanation. Wish you stay healthy and enthusiastic to share more knowledges with us
I love you so much Hussein thank you for being alive!
Thank you so much, Hussein. I am learning so much thanks to you.
You explain things very well. Thank you for your efforts.
Thanks Tariq appreciate it! Have a great weekend and enjoy the content
With great power comes great responsibility, this is the first thing that comes into my mind when graphql is mentioned. The problem with graphql is that it needs a learning curve itself and the problems it comes with are different, for example the N+1 problem, and to solve it you most probably will use solutions (like dataloaders) that may bring even new problems, also the graphql specification didn't cover alot of implications like security.
Ibrahim Mohammed well said! I think Your talking more from the backend implementation of GraphQL and yes that has its own set of challenges And thanks for mentioning the N+1 problem as well.
@@hnasr urw Hussein and thanks for this great video, looking forward for more videos
I love your courses
Very coolisher video, thank you!
One can limit number of requests per minute and number of requests per month for each client to stop any attacks.
Thank you!!!
awesome tutorial. thank you!
Please explain the term "Rest is Schema-Less". When I use the Rest we do have the Model(Bean), may join couple of tables but finally one model, which we represent to consumers. So I am consufed that even rest has schema associated with it. Any reference is also fine.
MasterPiece!!
Thank you so much.
Getting to the point with a very clear yet short explanation is one of the things one admire about this channel, thank you!
One thing that would have made this video greater if you used a GraphQl Client like Altair (A Chrome extension) that loads the schema and offers a complete playground for working with graphql apis, kindly check it out.
im pretty new to webdev, and would appreciate clarity on this point-
Hussein refers to REST as "schema-less" in comparison to GraphQL.
why is that?
when I've made RESTful API's, they've had server-side 'controller' functions which either format very specific db queries, or reformat the db response to fit what the client is requesting before sending back a response. isn't this a schema of sorts? is this not a best practice?
The difference is that you can change the backend to whatever you want and the client won't know about it.
You have to shake hands and communicate between frontend and backend and decide on a schema.
With GraphQL there's no handshake or meetings needed to define schemas. You can simply query for whatever you want. And backend won't be able to break the frontend because you cannot change already existing schemas.
Great content, But the low tune makes a lot of misses for me.
Hussein Sir could do please make a content on Restful API
got it you already did it
Awesome man!
Allah bless you!
💙💜👍
Mohammed Samir Mohammed ❤️❤️❤️ شكرا عزيزي
👌👌👌👌
in a single REST call we can do everything what graphQL can do. if requirement is there ...
Hi Hussein
Can you please make one tutorial, Where client(front end : React, server: express-graphql, apollo-server and database: postgresql) can upload photo to database. I know I am asking too much but it will help lots of young developers like me.
Thanks for such a nice tutorials.
you may need to find a magic lamp mate!
Bro i am checking your videos for last few months, just a suggestion : Don't focus on content length , Make it as crisp as possible. Keep spreading knowledge. Awesome tutorials.
উনি যথেষ্ঠ engaging video create করেন। আপনাকে বেশি জ্ঞান দিতে হবে না ।
🙏🙏🙏❤️❤️❤️❤️❤️
هل برأيك متحدثو الإنجليزية بحاجة إلى من يشرح لهم تقنية شُرحت لديهم عشرات المرات؟
أم أنك غافل عن حال المصادر التعليمية العربية المتدهور؟
أم أنك آثرت التصدق على عدوك الغني على حساب أخيك الفقير؟
the video is too long, you talk a lot with no infos, I even make the speed of the video 2x and still felt bored out of my mind, I will lookup other videos to learn GraphQL
🙏🙏🙏❤️❤️❤️❤️❤️❤️