Professional Documents
Culture Documents
REST
Representational State Transfer
HTTP Request
Data Storage
Web
Client HTTP Response API Database…
Server
Repository
REST
What’s really going inside?
HTTP GET
/users/<id>
/users/<id>posts
Client /users/<id>/
{
followers
“user: {
“id”: “rfdklw”
“name”: “Ana”
}
}
Why GraphQL?
REST
What’s really going on inside?
HTTP GET
/users/<id>
/users/<id>posts
Client {
/users/<id>/
“posts: [{
followers
“id”: “norkdfs”
“title”: “GQL Course”
“content”: “Keep
learning…”
}]
}
Why GraphQL?
REST
What’s really going on inside?
HTTP GET
/users/<id>
/users/<id>posts
Client { /users/<id>/
“followers: [{ followers
“id”: “naodoraks”
“name”: “Lwoen”
“about”: “Worker”
}]
}
Why GraphQL?
See a pattern?
Lot’s of unnecessary requests to different endpoints!
HTTP GET
/users/<id>
/users/<id>posts
Client { /users/<id>/
“followers: [{ followers
“id”: “naodoraks”
“name”: “Lwoen”
“about”: “Worker”
}]
}
Why GraphQL?
GraphQL solves this
issue!
query {
User(id: “98ded”) {
name
posts {
title
}
}
}
Client GraphQL
{
“data: {
“User”: {
“name”: “James”
“posts”: [
{
title: “Be great”
}
],
}
}
Why GraphQL?
Facebook Created this
New Data Query
Language
(Graph)QL as a Whole
A B
Facebook connections
A B
D
E
c
{
User(id:1){
Hobby
name
Query title
startDate
age
User 2
siblings {
name
age id
name
Sibling
name age
age
hobby {
title
….
Query }
}
}
}
Learning Path
Client GraphQL
(Android) server
Learning Path
Client GraphQL
(Android) server
Relationship
User
id
name
age
profession
….
[Hobby]
[Post]
Hobby
Post
id
id
title
comment
description
userId userId
Mutations
mu·tate
/ˈmyo͞ otāt/
verb
Queries
+ Mutations
Fetching
&
Modifying
MongoDB
RDBMS MongoDB
(Relational)DBMS
RDBMS
RDBMS