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 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
53
The State of GraphQL in 2018
notrab
0
76
React Server Side Rendering with Next.js
notrab
0
160
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
8
800
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
357
30k
A Modern Web Designer's Workflow
chriscoyier
694
190k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
44
2.4k
It's Worth the Effort
3n
185
28k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
YesSQL, Process and Tooling at Scale
rocio
173
14k
Adopting Sorbet at Scale
ufuk
77
9.4k
The Pragmatic Product Professional
lauravandoore
35
6.7k
Building Applications with DynamoDB
mza
95
6.5k
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