GraphQL Crash Course

preview_player
Показать описание


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

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

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

Stay Awesome!
Hussein
Рекомендации по теме
Комментарии
Автор

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

hnasr
Автор

The guy really enjoys teaching! Such a cool one.

mrcrazyenough
Автор

The way you explain, makes all the difference. Thanks for all the wonderful tutorials and for many more to come. God Bless you! :)

suhasc
Автор

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 ❤

mtvspec
Автор

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!

mateoguevara
Автор

Ok, after endless procrastination, I finally got to this :D Thank you!!!

BHFJohnny
Автор

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.

kamarajkannan
Автор

hussein: don't get attached to anything,
Me, already attached to this channel, watching backend things

animatedzombie
Автор

A great starting point to learn GraphQL to learn it in depth.

the_maroon_knight
Автор

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
Автор

Honestly, I love your videos, Thanks Hussein! No other videos actually make me smile while I listen

stevoschannel
Автор

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

alekseiborsenkodev
Автор

You explain things very well. Thank you for your efforts.

khatritariq
Автор

Well understood. Both REST and GraphQL are great technologies, depending on what your client request types are. Thank you

elijahlair
Автор

I love you so much Hussein thank you for being alive!

falanges
Автор

استاذ حسين كل الحب زادك الله علما ونفعا به

qsami
Автор

Really good eplanation at the start about what makes GraphQL different from REST and a good option

smoothbeak
Автор

Thank you so much, Hussein. I am learning so much thanks to you.

yadusolparterre
Автор

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.

amu
Автор

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?

willymcnamara