Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GraphQL & beyond
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Felipe Luiz Soares
November 17, 2018
Technology
0
57
GraphQL & beyond
Felipe Luiz Soares
November 17, 2018
Tweet
Share
More Decks by Felipe Luiz Soares
See All by Felipe Luiz Soares
Writing unit tests with Jest using test best practices
felipesoares6
0
190
Comecei uma tarefa e olha no que deu!
felipesoares6
0
56
HTML + CSS
felipesoares6
1
150
THE MEANING OF LIFE FRONT-END USER EXPERIENCE AND EVERYTHING
felipesoares6
0
64
BEM
felipesoares6
0
74
Read-Search-Ask
felipesoares6
1
94
Other Decks in Technology
See All in Technology
usermode linux without MMU - fosdem2026 kernel devroom
thehajime
0
230
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
5.5k
Tebiki Engineering Team Deck
tebiki
0
24k
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.8k
GitLab Duo Agent Platform × AGENTS.md で実現するSpec-Driven Development / GitLab Duo Agent Platform × AGENTS.md
n11sh1
0
140
SRE Enabling戦記 - 急成長する組織にSREを浸透させる戦いの歴史
markie1009
0
120
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
10k
AI駆動PjMの理想像 と現在地 -実践例を添えて-
masahiro_okamura
1
120
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
310
Amazon Bedrock Knowledge Basesチャンキング解説!
aoinoguchi
0
150
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
AI駆動開発を事業のコアに置く
tasukuonizawa
1
200
Featured
See All Featured
A Soul's Torment
seathinner
5
2.3k
Optimizing for Happiness
mojombo
379
71k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Crafting Experiences
bethany
1
49
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
68
Tell your own story through comics
letsgokoyo
1
810
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Building Applications with DynamoDB
mza
96
6.9k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
420
How STYLIGHT went responsive
nonsquared
100
6k
Producing Creativity
orderedlist
PRO
348
40k
Everyday Curiosity
cassininazir
0
130
Transcript
GRAPHQL & beyond @felipesoares_
why how when
@felipesoares6_ felipesoares6
None
None
None
None
GraphQL is a query language
& alternative to REST
None
+
graphs -> nodes -> edges
query language SELECT * FROM
type House { edge: Person } type Person { ...
}
why?
None
3 reasons
get just what you want
enables declarative data fetching
overfetching
underfetching
nice and smooth contracts
+ typed schemas + docs
playground
clients everywhere
only exposes a single endpoint
consume the same endpoint in != ways
how?
-> schema -> queries -> mutations -> resolvers -> responses
schema
type Query { users: [User!]!, user: User! }
type User { id: ID!, name: String, email: String }
schema -> queries -> mutations resolvers responses
queries
GET /users query { users { id, name, email }
}
mutations
POST /users mutation { createUser( name: “Felipeson”, email: “
[email protected]
” )
{ id } }
schema queries mutations -> resolvers responses
resolvers
resolvers = { Query: { users: () => getUsers(), user:
(_, { id }) => getUser(id), ???: () => fetch(‘api.com/top’) } }
schema queries mutations resolvers -> responses
responses
loading
“data”: { users: [ { id: “1”, name: “Felipe Soares”,
email: “
[email protected]
” } ] } query { users { id, name, email } }
“errors”: [ { “message”: “error”, “location”: … , “fields”: ...
} ] query { users { id, name, gender } }
how how
server-side bit.ly/2OYP9IS
prisma
data-base layer
None
application layer
None
client-side bit.ly/2zRBNUq
apollo
query
import gql from ‘graphql-tag’ import { Query } from ‘react-apollo’
const GET_USERS = gql` query { users { id, name,
email } }`
<Query query={GET_USERS}> {({ load, error, data }) => { ...
} </Query>
if (load) { return <Load load={load} /> }
if (data.users) { return <List items={data} /> }
if (error) { return <Error error={error} /> }
mutation
import gql from ‘graphql-tag’ import { Mutation } from ‘react-apollo’
const CREATE_USER = gql` mutation { createUser( name: “Felipeson”, email:
“
[email protected]
” ) { id, name, email } }`
<Mutation mutation={CREATE_USER}> {( createUser , { load, error, data })
=> { ... } </Mutation>
<div> ... <UserForm submit={createUser} /> </div>
when?
is difficult to close the API contracts
overfetching underfetching
consume the same endpoint in != ways
consuming != APIs
learn something new!
thanks! @felipesoares6_ felipesoares6 bit.ly/2OYP9IS bit.ly/2zRBNUq client-side server-side