Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
GraphQL in a REST world
Search
Jamie Barton
November 15, 2017
0
170
GraphQL in a REST world
In this talk I gave a short introduction into GraphQL.
Jamie Barton
November 15, 2017
Tweet
Share
More Decks by Jamie Barton
See All by Jamie Barton
The Content Mesh - Berlin
notrab
0
57
The State of GraphQL in 2018
notrab
0
79
React Server Side Rendering with Next.js
notrab
0
170
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
34
9k
A Tale of Four Properties
chriscoyier
162
23k
Optimizing for Happiness
mojombo
379
70k
Side Projects
sachag
455
43k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Being A Developer After 40
akosma
91
590k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Designing Experiences People Love
moore
143
24k
It's Worth the Effort
3n
187
29k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
BBQ
matthewcrist
89
9.9k
Scaling GitHub
holman
464
140k
Transcript
@notrab
@notrab
@notrab Jamie Barton
@notrab @notrab
@notrab Frontend Developer
@notrab @norseal
@notrab Ruby on Rails Sorry @dhh
@notrab Ruby
@notrab jQuery
@notrab jQuery JavaScript* * React, Node, Serverless, Lambda, GraphQL, Apollo
and more
@notrab • React • Redux • Flow • NextJS •
Styled components • Node • GraphQL
@notrab • React • Redux • Flow • NextJS •
Styled components • Node • GraphQL
@notrab
@notrab REST
@notrab Expensive payloads
@notrab
@notrab Over-fetching
@notrab Multiple round trips
@notrab
@notrab Custom endpoints /product_with_categories
@notrab /product_with_categories /mobile/product_with_categories
@notrab Versioning /v2
@notrab
@notrab There has to be a better way
@notrab json:api
@notrab
@notrab …
@notrab Slower development json:api
@notrab Return of custom endpoints json:api
@notrab
@notrab Seriously, there has to be a better way
@notrab March 2017
@notrab
@notrab
@notrab
@notrab
@notrab
@notrab Start thinking in Graphs and not Endpoints
@notrab GraphQL
@notrab GraphQL • Query language for APIs • Built by
Facebook (open sourced in 2015) • Declarative way of querying/fetching data • Works with any database • Typed spec • Support for Go, Ruby, JavaScript & more • Used by companies such as Ticketmaster, GitHub & KLM
@notrab GraphQL is not a database
@notrab GraphQL is not just a React “thing”
@notrab But it’s awesome with React
@notrab ¯\_(ツ)_/¯
@notrab { allProducts { id name amount category { id
name } } } Query
@notrab { "data": { "allProducts": [ { "id": "cj8rkz8dle9r40179cqxt598k", "name":
"iPhone X", "amount": 0, "category": { "id": "cj8t5syc206p30199dbz7a5st", "name": "iPhone" } } ] } } Response
@notrab { "data": { "allProducts": [ { "id": "cj8rkz8dle9r40179cqxt598k", "name":
"iPhone X", "amount": 0, "category": { "id": "cj8t5syc206p30199dbz7a5st", "name": "iPhone" } } ] } } Query Response { allProducts { id name amount category { id name } } }
@notrab No more client-specific endpoints
@notrab
@notrab No more outdated documentation
@notrab
@notrab https://news.ycombinator.com/item?id=15661888
@notrab Put a universal API over your existing backends apollographql.com
@notrab
@notrab There is more to GraphQL
@notrab • Mutations • Subscriptions • Fragments
@notrab • Mutations • Subscriptions • Fragments
@notrab
@notrab
@notrab
@notrab • Mutations • Subscriptions • Fragments
@notrab
@notrab
@notrab
@notrab • Mutations • Subscriptions • Fragments
@notrab
@notrab
@notrab
@notrab
@notrab
@notrab Client Gateway Server Caching Apollo Engine Schema stitching Typical
GraphQL API
@notrab Server side
@notrab graph.cool
@notrab Client side
@notrab graphcool/graphql-request
@notrab
@notrab
@notrab Client side
@notrab
@notrab Demo
@notrab Demo
@notrab
@notrab But what about using GraphQL today?
@notrab Ask your manager for 12 months to migrate to
GraphQL
@notrab Move from monolith to microservices
@notrab Experiment new “feature requests” with GraphQL
@notrab Where to go from here?
@notrab
@notrab Links of interest • https://graphql.com • https://www.howtographql.com • https://graphql.com/tutorials
• https://www.graph.cool/docs/tutorials
@notrab
@notrab