SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Basics of Apollo Server II (GraphQL)
- By Sumit
2
NodeXperts
Topics
- Why we use GraphQL?
- Before GraphQL.
- After GraphQL.
- Problems in REST?
- GraphQL in the logical architecture.
- Next Session Topic
3
NodeXperts
Why we use GraphQL?
In our last session we have learnt that GraphQL is use to create API.
There are three operations in GraphQL to create API.
- Query
- Mutation
- Subscription.
But we have ways to create API before GraphQL. Let's look into that.
4
NodeXperts
Before GraphQL?
Before GraphQL we create API’s using REST
method in which we have HTTP method like -
- GET
- POST
- PUT
- DELETE
So, we have all the operations required to query or
manipulate the data from database, then why we
need GraphQL? Let’s look on GraphQL now.
5
NodeXperts
After GraphQL?
Now we know that GraphQL has three operations,
let’s look explore its operations.
- Query is same as we have GET request in HTTP.
- Mutation is same as we have POST, PUT,
DELETE request in HTTP.
- Subscription this is new introduced in GraphQL.
So, now we know that what Query and Mutation is,
but we have a new entry here, Subscription. What
is that? Let’s explore it.
6
NodeXperts
The team structure of
each DAN POD is
optimised per set
hierarchy
After GraphQL
So, before GraphQL when we have REST API if there is any change in data in database the client is unaware
of that. So, how client will get the new data.
- If the page is reloaded then it will send the request to the server and in response server returns the new
data.
- Second method is implement websocket to get the new data. As client gets the real-time data in
websocket but it takes time to implement the websocket.
To get the new data on client using REST API either we need to reload the page or implement websocket.
Here comes Subscription in picture, it ensures client that it will keep client updated on any data change.
7
NodeXperts
Query Complexity
- Fetching multiple resources require making
multiple calls to the server. With GraphQL
query we can do that in a single query.
As we can see in diagram, if I want user we make
on request, if I want all the posts related to user
we make another request to fetch that.
Problems in REST
8
NodeXperts
Problems in REST
Over Fetching and Under Fetching
- In REST Api we end up with getting lot of extra
data or incomplete data for which we have make
extra calls to get complete data. Using graphQL
we get the exact data what we want in a single
request.
In the image we can see that we want only the
picture of user we get name and location along with
that, it is called over fetching.
9
NodeXperts
Problems in REST
Validation and type Checking
- In REST Api we do not have any method for type checking or if we want that then we need to
implement typescript in that. Apart from that Typescript is also implements check until compile time.
In GraphQL we have type check available at run time. So, client knows in well advance that what is
available for the query.
Autogenerating API Documentation
- In REST we spend lot of time in documentation, we use tools like swagger to document API. In
GraphQL the API documentation is automatically done with each changes in the schema. We will see
that when we are writing the schema.
10
NodeXperts
GraphQL in the logical Architecture
Before graphQL if we want data to be fetched
from multiple resources we use to process and
aggregate the data on client which increase the
complexity on client.
After graphQL now we can get the data on
graphQL and process data and send it to client.
So client receives only that data which it requires
to show to the end user.
11
NodeXperts
Next Session Topics:
- Schema
- Resolvers
- Introspection in graphQL.

Contenu connexe

Tendances

Tendances (20)

Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
Graph ql vs rest api - Seven Peaks Software (Node.JS Meetup 18 nov 2021)
 
How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)How web works and browser works ? (behind the scenes)
How web works and browser works ? (behind the scenes)
 
Anatomy of Data Source API : A deep dive into Spark Data source API
Anatomy of Data Source API : A deep dive into Spark Data source APIAnatomy of Data Source API : A deep dive into Spark Data source API
Anatomy of Data Source API : A deep dive into Spark Data source API
 
Reactive Cocoa
Reactive CocoaReactive Cocoa
Reactive Cocoa
 
Introducing LINQ
Introducing LINQIntroducing LINQ
Introducing LINQ
 
Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)Module 3: Introduction to LINQ (PowerPoint Slides)
Module 3: Introduction to LINQ (PowerPoint Slides)
 
Linq
LinqLinq
Linq
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
LINQ
LINQLINQ
LINQ
 
Linq to sql
Linq to sqlLinq to sql
Linq to sql
 
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course AhmedabadIntroduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
Introduction Of Linq , ASP.NET Training Ahmedabad, ASP.NET Course Ahmedabad
 
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/MeteorWhy UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
Why UI Developers Love GraphQL - Sashko Stubailo, Apollo/Meteor
 
GraphQL Search
GraphQL SearchGraphQL Search
GraphQL Search
 
Anatomy of in memory processing in Spark
Anatomy of in memory processing in SparkAnatomy of in memory processing in Spark
Anatomy of in memory processing in Spark
 
Scalable Machine Learning Pipeline For Meta Data Discovery From eBay Listings
Scalable Machine Learning Pipeline For Meta Data Discovery From eBay ListingsScalable Machine Learning Pipeline For Meta Data Discovery From eBay Listings
Scalable Machine Learning Pipeline For Meta Data Discovery From eBay Listings
 
Anatomy of Data Frame API : A deep dive into Spark Data Frame API
Anatomy of Data Frame API :  A deep dive into Spark Data Frame APIAnatomy of Data Frame API :  A deep dive into Spark Data Frame API
Anatomy of Data Frame API : A deep dive into Spark Data Frame API
 
Attacking GraphQL
Attacking GraphQLAttacking GraphQL
Attacking GraphQL
 
GraphQL Misconfiguration
GraphQL MisconfigurationGraphQL Misconfiguration
GraphQL Misconfiguration
 
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
JSONB Tricks: Operators, Indexes, and When (Not) to Use It | PostgresOpen 201...
 
apidays LIVE Paris 2021 - GraphQL Today and Tomorrow by Uri Goldshtein, The G...
apidays LIVE Paris 2021 - GraphQL Today and Tomorrow by Uri Goldshtein, The G...apidays LIVE Paris 2021 - GraphQL Today and Tomorrow by Uri Goldshtein, The G...
apidays LIVE Paris 2021 - GraphQL Today and Tomorrow by Uri Goldshtein, The G...
 

Similaire à Apollo server II

Similaire à Apollo server II (20)

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
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Graphql
GraphqlGraphql
Graphql
 
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 with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
GraphQL Introduction with Spring Boot
GraphQL Introduction with Spring BootGraphQL Introduction with Spring Boot
GraphQL Introduction with Spring Boot
 
servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0servlet 2.5 & JSP 2.0
servlet 2.5 & JSP 2.0
 
Why UI developers love GraphQL
Why UI developers love GraphQLWhy UI developers love GraphQL
Why UI developers love GraphQL
 
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
Choisir entre une API  RPC, SOAP, REST, GraphQL?  
Et si le problème était ai...Choisir entre une API  RPC, SOAP, REST, GraphQL?  
Et si le problème était ai...
Choisir entre une API RPC, SOAP, REST, GraphQL? 
Et si le problème était ai...
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
 
apidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuseapidays LIVE Paris - GraphQL meshes by Jens Neuse
apidays LIVE Paris - GraphQL meshes by Jens Neuse
 
Http and REST APIs.
Http and REST APIs.Http and REST APIs.
Http and REST APIs.
 
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
 
Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6Kochi Mulesoft Meetup #6
Kochi Mulesoft Meetup #6
 
Deploying Machine Learning in production without servers - #serverlessCPH
Deploying Machine Learning in production without servers - #serverlessCPHDeploying Machine Learning in production without servers - #serverlessCPH
Deploying Machine Learning in production without servers - #serverlessCPH
 
Wrapping and securing REST APIs with GraphQL
Wrapping and securing REST APIs with GraphQLWrapping and securing REST APIs with GraphQL
Wrapping and securing REST APIs with GraphQL
 
How to provide a GraphQL API - I want it that way
How to provide a GraphQL API - I want it that wayHow to provide a GraphQL API - I want it that way
How to provide a GraphQL API - I want it that way
 
CONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQLCONDG April 23 2020 - Baskar Rao - GraphQL
CONDG April 23 2020 - Baskar Rao - GraphQL
 
Spring cloud Service-Discovery
Spring cloud Service-DiscoverySpring cloud Service-Discovery
Spring cloud Service-Discovery
 

Plus de NodeXperts

Plus de NodeXperts (19)

ECMA Script
ECMA ScriptECMA Script
ECMA Script
 
React Context API
React Context APIReact Context API
React Context API
 
Devops - Microservice and Kubernetes
Devops - Microservice and KubernetesDevops - Microservice and Kubernetes
Devops - Microservice and Kubernetes
 
Introduction to EC2 (AWS)
Introduction to EC2 (AWS)Introduction to EC2 (AWS)
Introduction to EC2 (AWS)
 
Reactive Application Using METEOR
Reactive Application Using METEORReactive Application Using METEOR
Reactive Application Using METEOR
 
Getting Reactive Data
Getting Reactive DataGetting Reactive Data
Getting Reactive Data
 
State, Life cycle, Methods & Events
State, Life cycle, Methods & Events State, Life cycle, Methods & Events
State, Life cycle, Methods & Events
 
Refs in react
Refs in reactRefs in react
Refs in react
 
Flow router, components and props
Flow router, components and propsFlow router, components and props
Flow router, components and props
 
Using react with meteor
Using react with meteorUsing react with meteor
Using react with meteor
 
Introduction to Reactjs
Introduction to ReactjsIntroduction to Reactjs
Introduction to Reactjs
 
Mobile apps using meteor - Part 1
Mobile apps using meteor - Part 1Mobile apps using meteor - Part 1
Mobile apps using meteor - Part 1
 
Microservice architecture : Part 1
Microservice architecture : Part 1Microservice architecture : Part 1
Microservice architecture : Part 1
 
Reactive web applications using MeteorJS
Reactive web applications using MeteorJSReactive web applications using MeteorJS
Reactive web applications using MeteorJS
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpack
 
Meteor workshop
Meteor workshopMeteor workshop
Meteor workshop
 
Introduction to meteor
Introduction to meteorIntroduction to meteor
Introduction to meteor
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+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@
 

Dernier (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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
 
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...
 
+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...
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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...
 
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
 

Apollo server II

  • 1. Basics of Apollo Server II (GraphQL) - By Sumit
  • 2. 2 NodeXperts Topics - Why we use GraphQL? - Before GraphQL. - After GraphQL. - Problems in REST? - GraphQL in the logical architecture. - Next Session Topic
  • 3. 3 NodeXperts Why we use GraphQL? In our last session we have learnt that GraphQL is use to create API. There are three operations in GraphQL to create API. - Query - Mutation - Subscription. But we have ways to create API before GraphQL. Let's look into that.
  • 4. 4 NodeXperts Before GraphQL? Before GraphQL we create API’s using REST method in which we have HTTP method like - - GET - POST - PUT - DELETE So, we have all the operations required to query or manipulate the data from database, then why we need GraphQL? Let’s look on GraphQL now.
  • 5. 5 NodeXperts After GraphQL? Now we know that GraphQL has three operations, let’s look explore its operations. - Query is same as we have GET request in HTTP. - Mutation is same as we have POST, PUT, DELETE request in HTTP. - Subscription this is new introduced in GraphQL. So, now we know that what Query and Mutation is, but we have a new entry here, Subscription. What is that? Let’s explore it.
  • 6. 6 NodeXperts The team structure of each DAN POD is optimised per set hierarchy After GraphQL So, before GraphQL when we have REST API if there is any change in data in database the client is unaware of that. So, how client will get the new data. - If the page is reloaded then it will send the request to the server and in response server returns the new data. - Second method is implement websocket to get the new data. As client gets the real-time data in websocket but it takes time to implement the websocket. To get the new data on client using REST API either we need to reload the page or implement websocket. Here comes Subscription in picture, it ensures client that it will keep client updated on any data change.
  • 7. 7 NodeXperts Query Complexity - Fetching multiple resources require making multiple calls to the server. With GraphQL query we can do that in a single query. As we can see in diagram, if I want user we make on request, if I want all the posts related to user we make another request to fetch that. Problems in REST
  • 8. 8 NodeXperts Problems in REST Over Fetching and Under Fetching - In REST Api we end up with getting lot of extra data or incomplete data for which we have make extra calls to get complete data. Using graphQL we get the exact data what we want in a single request. In the image we can see that we want only the picture of user we get name and location along with that, it is called over fetching.
  • 9. 9 NodeXperts Problems in REST Validation and type Checking - In REST Api we do not have any method for type checking or if we want that then we need to implement typescript in that. Apart from that Typescript is also implements check until compile time. In GraphQL we have type check available at run time. So, client knows in well advance that what is available for the query. Autogenerating API Documentation - In REST we spend lot of time in documentation, we use tools like swagger to document API. In GraphQL the API documentation is automatically done with each changes in the schema. We will see that when we are writing the schema.
  • 10. 10 NodeXperts GraphQL in the logical Architecture Before graphQL if we want data to be fetched from multiple resources we use to process and aggregate the data on client which increase the complexity on client. After graphQL now we can get the data on graphQL and process data and send it to client. So client receives only that data which it requires to show to the end user.
  • 11. 11 NodeXperts Next Session Topics: - Schema - Resolvers - Introspection in graphQL.