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
Felipe Luiz Soares
November 17, 2018
Technology
0
55
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
180
Comecei uma tarefa e olha no que deu!
felipesoares6
0
52
HTML + CSS
felipesoares6
1
140
THE MEANING OF LIFE FRONT-END USER EXPERIENCE AND EVERYTHING
felipesoares6
0
59
BEM
felipesoares6
0
72
Read-Search-Ask
felipesoares6
1
92
Other Decks in Technology
See All in Technology
AIエージェント就活入門 - MCPが履歴書になる未来
eltociear
0
560
そのコンポーネント、サーバー?クライアント?App Router開発のモヤモヤを可視化する補助輪
makotot
4
630
Figma + Storybook + PlaywrightのMCPを使ったフロントエンド開発
yug1224
10
2.9k
Amazon Bedrock AgentCore でプロモーション用動画生成エージェントを開発する
nasuvitz
6
450
退屈なことはDevinにやらせよう〜〜Devin APIを使ったVisual Regression Testの自動追加〜
kawamataryo
3
740
[OCI Skill Mapping] AWSユーザーのためのOCI(2025年8月20日開催)
oracle4engineer
PRO
2
150
実践アプリケーション設計 ②トランザクションスクリプトへの対応
recruitengineers
PRO
4
520
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
8.6k
Goss: Faiss向けの新しい本番環境対応 Goバインディング #coefl_go_jp
bengo4com
0
1.4k
GitHub Copilot coding agent を推したい / AIDD Nagoya #1
tnir
4
4.7k
つくって納得、つかって実感! 大規模言語モデルことはじめ
recruitengineers
PRO
25
6.7k
制約理論(ToC)入門
recruitengineers
PRO
5
820
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Being A Developer After 40
akosma
90
590k
How to Think Like a Performance Engineer
csswizardry
25
1.8k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
For a Future-Friendly Web
brad_frost
179
9.9k
Docker and Python
trallard
45
3.5k
Faster Mobile Websites
deanohume
309
31k
Designing for Performance
lara
610
69k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
185
54k
The Invisible Side of Design
smashingmag
301
51k
The Pragmatic Product Professional
lauravandoore
36
6.8k
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