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
Building Adaptive Systems
keathley
43
2.8k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
33
2.5k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
53k
YesSQL, Process and Tooling at Scale
rocio
173
14k
How STYLIGHT went responsive
nonsquared
100
5.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.7k
The World Runs on Bad Software
bkeepers
PRO
72
11k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
Writing Fast Ruby
sferik
629
62k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.1k
Build your cross-platform service in a week with App Engine
jlugia
232
18k
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