GraphQl
Harutyun
Abgaryan
@abg_harut
abgaryanharutyun
What do we have?
● RestFul backend Api
● Client App
What do we need?
Integration of a new type of client how use our data.
What can we do?
● Use existing endpoint
● Create new endpoint for each new client type
● Create custom/internal endpoints
● Refactor existing API
● Find a better solution
Data
API 1
Web Client
API 2
Mobile Client
Main problems
● Web and mobile use different data and different endpoints
● Too many request from old existing api (over-fetching/ under-fetching)
● Data types
Introducing GraphQl
What is GraphQL?
● A query language for your API (A data query language)
● Runtime for queries. (Spec/ specification)
POST /graphql
Hello GraphGL
{
product{
name,
description
}
}
Selection set
Fields
Hello GraphQL
Query {
product{
name,
description
}
}
{
product: {
name: Apple,
description: “good devices”
}
}
Hello GraphQl
query MyProduct($id: ID!) {
product($id: $id) {
name,
description
devices {
name,
model
}
}
}
{
product {
Name: “apple”
Description: “Good device”
devices: [
{name: “iPhone”, model: “x”},
{name: “iPad”, model: “Pro”}
]
}
}
Type Definition and Resolvers
type Product {
id: ID!
name: STRING
description: STRING
devices: [Device]
}
The Schema
type Query {
product(id: ID!): Product
products: [Product]
device(id: ID!): Device
devices: [Device]
}
type Mutation {
addProduct(id: ID!): Product
updateDevice(id: ID!): Device
}
The Resolvers
const Resolvers = {
products: () => db.products.list,
product: (parent, { id }) => db.products.findByPk(id)
}
Problems
● N+1 queries
● Growing query complexity
● Error handling
● HTTP caching
Data
Backend
Web Client
GraphQL
Mobile Client
console.log(“Thank you!”)

More Related Content

PPT
Graphql presentation
PPTX
React inter3
PDF
GraphQL the holy contract between client and server
PDF
Graphql
PPTX
Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)
PDF
Why UI developers love GraphQL
PDF
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
PDF
GraphQL with .NET Core Microservices.pdf
Graphql presentation
React inter3
GraphQL the holy contract between client and server
Graphql
Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)
Why UI developers love GraphQL
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
GraphQL with .NET Core Microservices.pdf

Similar to GraphQL - Tidepool Labs (20)

PPTX
PPTX
GraphQL Introduction with Spring Boot
PDF
GraphQL Bangkok meetup 5.0
PPTX
Introduction to GraphQL
PPTX
GraphQL API Gateway and microservices
PDF
Introduction to GraphQL for beginners
PPTX
Introduction to GraphQL
PDF
PDF
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
PPTX
GraphQL, Redux, and React
PDF
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
PDF
GraphQL ♥︎ GraphDB
PDF
Marco Liberati - Graph analytics
PDF
GraphQL over REST at Reactathon 2018
PDF
Let's start GraphQL: structure, behavior, and architecture
PDF
Modern APIs with GraphQL
PDF
GraphQL + relay
PPTX
Introduction to Graph QL
PDF
REST to GraphQL migration: Pros, cons and gotchas
PPTX
Introduction to GraphQL Presentation.pptx
GraphQL Introduction with Spring Boot
GraphQL Bangkok meetup 5.0
Introduction to GraphQL
GraphQL API Gateway and microservices
Introduction to GraphQL for beginners
Introduction to GraphQL
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
GraphQL, Redux, and React
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
GraphQL ♥︎ GraphDB
Marco Liberati - Graph analytics
GraphQL over REST at Reactathon 2018
Let's start GraphQL: structure, behavior, and architecture
Modern APIs with GraphQL
GraphQL + relay
Introduction to Graph QL
REST to GraphQL migration: Pros, cons and gotchas
Introduction to GraphQL Presentation.pptx
Ad

Recently uploaded (20)

PPT
Chapter 1 - Introduction to Manufacturing Technology_2.ppt
PDF
Cryptography and Network Security-Module-I.pdf
PDF
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PPTX
Measurement Uncertainty and Measurement System analysis
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PPTX
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
PPTX
CONTRACTS IN CONSTRUCTION PROJECTS: TYPES
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PPTX
wireless networks, mobile computing.pptx
PDF
Design of Material Handling Equipment Lecture Note
PPTX
mechattonicsand iotwith sensor and actuator
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
Computer organization and architecuture Digital Notes....pdf
DOC
T Pandian CV Madurai pandi kokkaf illaya
PDF
Unit1 - AIML Chapter 1 concept and ethics
PDF
MLpara ingenieira CIVIL, meca Y AMBIENTAL
PDF
Computer System Architecture 3rd Edition-M Morris Mano.pdf
PPTX
Software Engineering and software moduleing
Chapter 1 - Introduction to Manufacturing Technology_2.ppt
Cryptography and Network Security-Module-I.pdf
Prof. Dr. KAYIHURA A. SILAS MUNYANEZA, PhD..pdf
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
Measurement Uncertainty and Measurement System analysis
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
Chapter 2 -Technology and Enginerring Materials + Composites.pptx
CONTRACTS IN CONSTRUCTION PROJECTS: TYPES
distributed database system" (DDBS) is often used to refer to both the distri...
wireless networks, mobile computing.pptx
Design of Material Handling Equipment Lecture Note
mechattonicsand iotwith sensor and actuator
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
Exploratory_Data_Analysis_Fundamentals.pdf
Computer organization and architecuture Digital Notes....pdf
T Pandian CV Madurai pandi kokkaf illaya
Unit1 - AIML Chapter 1 concept and ethics
MLpara ingenieira CIVIL, meca Y AMBIENTAL
Computer System Architecture 3rd Edition-M Morris Mano.pdf
Software Engineering and software moduleing
Ad

GraphQL - Tidepool Labs