SlideShare une entreprise Scribd logo
1  sur  44
Télécharger pour lire hors ligne
GraphQL
GRAPHQL
WHAT IS GRAPHQL?
GraphQL is an application layer
query language from Facebook.
GraphQL is a specification
GRAPHQL
MOTIVATION
2012
GRAPHQL
MOTIVATION
Lee Byron is an Engineer at Facebook
working on GraphQL. He’s been making
things at Facebook since 2008, including
Immutable.js, Mobile & JavaScript.
GRAPHQL
MOTIVATION
UP UNTIL 2012, NEWS FEED COULD ONLY BE
REQUESTED AND DELIVERED AS HTML FROM
OUR SERVERS. DURING THE EFFORT TO REBUILD
NEWS FEED AS A NATIVE IOS VIEW WE HAD TO
REVISIT THIS ARCHITECTURE TO GET RAW DATA
Lee Byron
GRAPHQL
WHAT IS GRAPHQL? http://facebook.github.io/graphql
GRAPHQL
Hello GraphQL
WHAT IS GRAPHQL?
GRAPHQL
WHAT IS GRAPHQL?
GRAPHQL
With GraphQL, you can define your
backend as a well-defined graph-based
schema. Then client applications can
query your dataset as they are needed.
WHAT IS GRAPHQL?
GRAPHQL
So, you don't need to change your
backend for data requirement changes in
client apps. This simply solves one of the
biggest problems in managing REST API.
WHAT IS GRAPHQL?
GRAPHQL
WHY GRAPHQL?
Path 

Management
Hell
GRAPHQL
GraphQL also allows client applications to
batch and fetch data very efficiently. For
an example, have a look at the following
GraphQL query:
WHAT IS GRAPHQL?
GRAPHQL
WHAT IS GRAPHQL?
This is a GraphQL query to fetch data for a blog post
with comments and author information
GRAPHQL
WHAT IS GRAPHQL? Here's the result of the above query:
GRAPHQL
WHAT IS GRAPHQL?
GraphiQL
GRAPHQL
▸ Declarative Query Language
▸ Hierarchical
▸ Product-centric
▸ Strong-typing
▸ Client-specified queries
WHAT IS GRAPHQL?
GRAPHQL
WHAT IS GRAPHQL?
GRAPHQL
WHAT IS GRAPHQL?
GraphQL is a query language for your API,
and a server-side runtime for executing
queries by using a type system you define
for your data
GRAPHQL
WHAT IS GRAPHQL?
▸ Query (GET)
▸ Mutation (POST/PUT/DELETE)
GraphQL Operations
GRAPHQL
STORY
A quick story before
GRAPHQL
STORY
A Frontend Dev will start a new
App and integrate with this
REST API
GRAPHQL
STORY
GRAPHQL
STORY
Design send the first layout
for our Frontend Dev
GRAPHQL
STORY
GRAPHQL
STORY http://swapi.co/api/films/
GRAPHQL
STORY
GRAPHQL
STORY
GRAPHQL
Let's write our first GraphQL query
QUERYING GRAPHQL
GRAPHQL
QUERYING GRAPHQL
GRAPHQL
Nested Querying
QUERYING GRAPHQL
GRAPHQL
Arguments
QUERYING GRAPHQL
GRAPHQL
Multiple fields
QUERYING GRAPHQL
GRAPHQL
Assigning a result to a variable
QUERYING GRAPHQL
GRAPHQL
Assigning a result to a variable
QUERYING GRAPHQL
GRAPHQL
Assigning a result to a variable
QUERYING GRAPHQL
GRAPHQL
Mutations are the way to change the dataset
behind GraphQL. A mutation is very similar to a
field in a GraphQL query, but GraphQL
assumes a mutation has side effects and
changes the dataset behind the schema.
INVOKING MUTATIONS
GRAPHQL
First mutation
INVOKING MUTATIONS
GRAPHQL
First mutation
INVOKING MUTATIONS
GRAPHQL
Multiple mutations
INVOKING MUTATIONS
GRAPHQL
Fragments are the way to group commonly used fields and reuse them.
FRAGMENTS
GRAPHQL
So check this query. It's the same as above, but with fragments:
FRAGMENTS
GRAPHQL
Fragments with nested fragmentsFRAGMENTS
GRAPHQL
Using query variables
QUERY VARIABLES
GRAPHQL
Using query variablesQUERY VARIABLES

Contenu connexe

Tendances

The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
Sashko Stubailo
 

Tendances (20)

Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
REST vs GraphQL
REST vs GraphQLREST vs GraphQL
REST vs GraphQL
 
How to GraphQL
How to GraphQLHow to GraphQL
How to GraphQL
 
Building Modern APIs with GraphQL
Building Modern APIs with GraphQLBuilding Modern APIs with GraphQL
Building Modern APIs with GraphQL
 
GraphQL
GraphQLGraphQL
GraphQL
 
Graphql
GraphqlGraphql
Graphql
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
 
Better APIs with GraphQL
Better APIs with GraphQL Better APIs with GraphQL
Better APIs with GraphQL
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
 
GraphQL vs REST
GraphQL vs RESTGraphQL vs REST
GraphQL vs REST
 
React & GraphQL
React & GraphQLReact & GraphQL
React & GraphQL
 
Introduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SFIntroduction to GraphQL: Mobile Week SF
Introduction to GraphQL: Mobile Week SF
 
Intro GraphQL
Intro GraphQLIntro GraphQL
Intro GraphQL
 
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
Introduction to GraphQL (or How I Learned to Stop Worrying about REST APIs)
 
Wroclaw GraphQL - GraphQL in Java
Wroclaw GraphQL - GraphQL in JavaWroclaw GraphQL - GraphQL in Java
Wroclaw GraphQL - GraphQL in Java
 
GraphQL
GraphQLGraphQL
GraphQL
 
REST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical LookREST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical Look
 
How to GraphQL: React Apollo
How to GraphQL: React ApolloHow to GraphQL: React Apollo
How to GraphQL: React Apollo
 

En vedette

En vedette (20)

GraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQLGraphQL Story: Intro To GraphQL
GraphQL Story: Intro To GraphQL
 
GraphQL IndyJS April 2016
GraphQL IndyJS April 2016GraphQL IndyJS April 2016
GraphQL IndyJS April 2016
 
Graphql
GraphqlGraphql
Graphql
 
Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015Zensations Drupal 8 GraphQL Presentation 2015
Zensations Drupal 8 GraphQL Presentation 2015
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay Introduction
 
Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)Relay: Seamless Syncing for React (VanJS)
Relay: Seamless Syncing for React (VanJS)
 
Work with V8 memory leaks
Work with V8 memory leaksWork with V8 memory leaks
Work with V8 memory leaks
 
Introduction to GraphQL at API days
Introduction to GraphQL at API daysIntroduction to GraphQL at API days
Introduction to GraphQL at API days
 
Migration microservices to GraphQL
Migration microservices to GraphQLMigration microservices to GraphQL
Migration microservices to GraphQL
 
Vue JS Intro
Vue JS IntroVue JS Intro
Vue JS Intro
 
Javascript MVVM with Vue.JS
Javascript MVVM with Vue.JSJavascript MVVM with Vue.JS
Javascript MVVM with Vue.JS
 
Enjoy the vue.js
Enjoy the vue.jsEnjoy the vue.js
Enjoy the vue.js
 
Swift + GraphQL
Swift + GraphQLSwift + GraphQL
Swift + GraphQL
 
Why Vue.js?
Why Vue.js?Why Vue.js?
Why Vue.js?
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 
An Introduction to Vuejs
An Introduction to VuejsAn Introduction to Vuejs
An Introduction to Vuejs
 
Vue.js for beginners
Vue.js for beginnersVue.js for beginners
Vue.js for beginners
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
London React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor CharyparLondon React August - GraphQL at The Financial Times - Viktor Charypar
London React August - GraphQL at The Financial Times - Viktor Charypar
 
Progressive Framework Vue.js 2.0
Progressive Framework Vue.js 2.0Progressive Framework Vue.js 2.0
Progressive Framework Vue.js 2.0
 

Similaire à Graphql Intro (Tutorial and Example)

Training Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL LibraryTraining Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL Library
Neo4j
 

Similaire à Graphql Intro (Tutorial and Example) (20)

Scaling your GraphQL applications with Dgraph
Scaling your GraphQL applications with DgraphScaling your GraphQL applications with Dgraph
Scaling your GraphQL applications with Dgraph
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
 
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Raoapidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
apidays LIVE Paris - The Rise of GraphQL for database APIs by Karthic Rao
 
Scaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships MatterScaling Your Team With GraphQL: Why Relationships Matter
Scaling Your Team With GraphQL: Why Relationships Matter
 
Create GraphQL server with apolloJS
Create GraphQL server with apolloJSCreate GraphQL server with apolloJS
Create GraphQL server with apolloJS
 
GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)GraphQL @ Manc.JS (March 2018)
GraphQL @ Manc.JS (March 2018)
 
GraphQL APIs is with eZ Platform, a Symfony CMS
GraphQL APIs is with eZ Platform, a Symfony CMSGraphQL APIs is with eZ Platform, a Symfony CMS
GraphQL APIs is with eZ Platform, a Symfony CMS
 
How has netflix embraced graph ql for rapid application development
How has netflix embraced graph ql for rapid application developmentHow has netflix embraced graph ql for rapid application development
How has netflix embraced graph ql for rapid application development
 
GraphQL Introduction
GraphQL IntroductionGraphQL Introduction
GraphQL Introduction
 
Tutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHPTutorial: Building a GraphQL API in PHP
Tutorial: Building a GraphQL API in PHP
 
Training Week: GraphQL 2022
Training Week: GraphQL 2022Training Week: GraphQL 2022
Training Week: GraphQL 2022
 
How easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performanceHow easy (or hard) it is to monitor your graph ql service performance
How easy (or hard) it is to monitor your graph ql service performance
 
GraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits togetherGraphQL across the stack: How everything fits together
GraphQL across the stack: How everything fits together
 
Boost your APIs with GraphQL 1.0
Boost your APIs with GraphQL 1.0Boost your APIs with GraphQL 1.0
Boost your APIs with GraphQL 1.0
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema Stitching
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
 
Training Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL LibraryTraining Series: Build APIs with Neo4j GraphQL Library
Training Series: Build APIs with Neo4j GraphQL Library
 
APIdays Paris 2018 - GraphQL Opening Talk: The State of GraphQL, Jonathan Jal...
APIdays Paris 2018 - GraphQL Opening Talk: The State of GraphQL, Jonathan Jal...APIdays Paris 2018 - GraphQL Opening Talk: The State of GraphQL, Jonathan Jal...
APIdays Paris 2018 - GraphQL Opening Talk: The State of GraphQL, Jonathan Jal...
 
Real-time GraphQL API with minimum coding and maximum benefit
 Real-time GraphQL API with minimum coding and maximum benefit Real-time GraphQL API with minimum coding and maximum benefit
Real-time GraphQL API with minimum coding and maximum benefit
 
The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018The GraphQL Ecosystem in 2018
The GraphQL Ecosystem in 2018
 

Dernier

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 

Graphql Intro (Tutorial and Example)