SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Basics of Apollo Server (GraphQL)
- By Sumit
Topics
- What is GraphQL
- Why GraphQL
- What is Apollo
- SDL (Schema Definition Language)
- Scalar Types
- Resolvers
- Operations in GraphQL
What is GraphQL?
- GraphQL is a query language for API which queries on
the data provided to it.
- It is not to be confused with Database query language
as it is not use to query on database.
- The data source for graphQL can be like API,
microservices, database.
Why GraphQL?
● Ask for what you need and get that data only. Same can be achieved by rest api by it is the core feature
of graphQL.
● Returns the data in the same format in which format we request the data.
● Comparatively less request - response cycle compared to rest api, it means you can fetch many
resources in single request.
● As GraphQL is strictly typed so, we can catch error during development time and apps is clear about the
request and response data.
● GraphQL has a powerful developer tools to test api and documentation.
Why GraphQL?
Typedef in data
type User {
name: String!
id: Int!
friends: [User!]!
}
Ask what you want
{
getUser{
name
friends {
name
}
}
}
Format of Response
{
“getUser”: {
name: “John”
friends: [{
name: “Alex”
},{
name: “Bob”
}]
}
}
The team structure of
each DAN POD is
optimised per set
hierarchy
What is Apollo?
● Apollo Server is a library use to create the graphQL server in node.js with an ease.
● Apollo Server is a wrapper over the graphQL and provide many inbuilt feature which we have to implement
ourselves if we use graphQL with node.js.
● It gives us a feature to combine multiple graphQL server into one by just combining the schema of different
server which hides all the complexity in itself and gives us a combined schema. It means that we can easily
combine different server into a one and provide a single interaction point for the client.
● It provides us multiple powerful libraries for different use cases like for batch processing of multiple graphql
queries it provides libraries apollo-link-batchapollo-link-batch-http, for attempting multiple times in case of
server and network error it provides library apollo-link-retry and for more you can refer here.
● The schema syntax we use in graphQL is called
SDL.
● SDL represents the relationship between the data
returned.
● The schema in the graphQL is stored as a string.
type Book {
title: String
author: Author
}
type Author {
name: String
books: [Book]
}
SDL (Schema Definition Language)
Scalar Types in GraphQL
Scalar types denotes the leaves of the data. GraphQL has five scalar types mentioned below.
● Int - Signed 32-bit integer
● Float - Signed double-precision floating-point value
● String - UTF-8 character sequence
● Boolean - true/false
● ID - A Unique Identifier
Resolvers
Resolvers is a method which is responsible for
generating the response against the graphql
operations.
Resovers can return the data or the promise
against any operations.
Signature of Resolvers
● parent: An object contains the result from the resolvers on the parent
type.
● args: An object contains the argument passed during the operations.
● context: An object available to all resolvers and share the state
across resolvers.
● info: Information about the execution state of the operations.
User: (parent, args, context, info) => response
Operations in GraphQL
There are 3 types of operations in GraphQL.
● Query: Query operation is just like we use get in http method, it is use to read data from the data provided to graphQL.
● Mutation: Mutation is use if we want to create, delete or update the data.
● Subscription: Subscription is the operation responsible for providing the updated data on each mutation. It means it helps
us in achieving reactivity on frontend (Client Side).
Important Links:
- GraphQL Resource: https://graphql.org/
- Apollo Resource: https://www.apollographql.com/docs/apollo-server/
- GraphQL Schema: https://graphql.org/learn/schema/

Contenu connexe

Tendances

Tendances (20)

Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
React & Redux JS
React & Redux JS React & Redux JS
React & Redux JS
 
Graphql
GraphqlGraphql
Graphql
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
 
An intro to GraphQL
An intro to GraphQLAn intro to GraphQL
An intro to GraphQL
 
GraphQL
GraphQLGraphQL
GraphQL
 
React & GraphQL
React & GraphQLReact & GraphQL
React & GraphQL
 
REST API Design & Development
REST API Design & DevelopmentREST API Design & Development
REST API Design & Development
 
GraphQL
GraphQLGraphQL
GraphQL
 
REST-API overview / concepts
REST-API overview / conceptsREST-API overview / concepts
REST-API overview / concepts
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
The Apollo and GraphQL Stack
The Apollo and GraphQL StackThe Apollo and GraphQL Stack
The Apollo and GraphQL Stack
 
Introducing Async/Await
Introducing Async/AwaitIntroducing Async/Await
Introducing Async/Await
 
How to GraphQL
How to GraphQLHow to GraphQL
How to GraphQL
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
React
React React
React
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Swagger With REST APIs.pptx.pdf
Swagger With REST APIs.pptx.pdfSwagger With REST APIs.pptx.pdf
Swagger With REST APIs.pptx.pdf
 

Similaire à Basics of Apollo Server (GraphQL) - Under 40 Characters

Modern APIs with GraphQL
Modern APIs with GraphQLModern APIs with GraphQL
Modern APIs with GraphQLTaikai
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservicesMohammed Shaban
 
Introduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptxIntroduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptxKnoldus Inc.
 
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 performanceLuca Mattia Ferrari
 
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 PHPAndrew Rota
 
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)Seven Peaks Speaks
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)Rob Crowley
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018Sashko Stubailo
 
Getting Started with Spring for GraphQL
Getting Started with Spring for GraphQLGetting Started with Spring for GraphQL
Getting Started with Spring for GraphQLVMware Tanzu
 
GraphQL Introduction with Spring Boot
GraphQL Introduction with Spring BootGraphQL Introduction with Spring Boot
GraphQL Introduction with Spring Bootvipin kumar
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQLKnoldus Inc.
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL APISean O'Brien
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationKnoldus Inc.
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Knoldus Inc.
 
Training Week: GraphQL 2022
Training Week: GraphQL 2022Training Week: GraphQL 2022
Training Week: GraphQL 2022Neo4j
 
A Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache SparkA Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache Sparkdatamantra
 

Similaire à Basics of Apollo Server (GraphQL) - Under 40 Characters (20)

Modern APIs with GraphQL
Modern APIs with GraphQLModern APIs with GraphQL
Modern APIs with GraphQL
 
GraphQL API Gateway and microservices
GraphQL API Gateway and microservicesGraphQL API Gateway and microservices
GraphQL API Gateway and microservices
 
Introduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptxIntroduction to GraphQL Presentation.pptx
Introduction to GraphQL Presentation.pptx
 
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
 
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
 
Attacking GraphQL
Attacking GraphQLAttacking GraphQL
Attacking GraphQL
 
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)
 
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
GraphQL - A query language to empower your API consumers (NDC Sydney 2017)
 
GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018GraphQL over REST at Reactathon 2018
GraphQL over REST at Reactathon 2018
 
Getting Started with Spring for GraphQL
Getting Started with Spring for GraphQLGetting Started with Spring for GraphQL
Getting Started with Spring for GraphQL
 
GraphQL Introduction with Spring Boot
GraphQL Introduction with Spring BootGraphQL Introduction with Spring Boot
GraphQL Introduction with Spring Boot
 
Introduction to GraphQL
Introduction to GraphQLIntroduction to GraphQL
Introduction to GraphQL
 
Kotlin REST & GraphQL API
Kotlin REST & GraphQL APIKotlin REST & GraphQL API
Kotlin REST & GraphQL API
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
 
Introduction to Testing GraphQL Presentation
Introduction to Testing GraphQL PresentationIntroduction to Testing GraphQL Presentation
Introduction to Testing GraphQL Presentation
 
Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)Testing Graph QL Presentation (Test Automation)
Testing Graph QL Presentation (Test Automation)
 
GraphQL
GraphQLGraphQL
GraphQL
 
Training Week: GraphQL 2022
Training Week: GraphQL 2022Training Week: GraphQL 2022
Training Week: GraphQL 2022
 
A Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache SparkA Tool For Big Data Analysis using Apache Spark
A Tool For Big Data Analysis using Apache Spark
 

Plus de NodeXperts

Apollo Server IV
Apollo Server IVApollo Server IV
Apollo Server IVNodeXperts
 
React Context API
React Context APIReact Context API
React Context APINodeXperts
 
Devops - Microservice and Kubernetes
Devops - Microservice and KubernetesDevops - Microservice and Kubernetes
Devops - Microservice and KubernetesNodeXperts
 
Introduction to EC2 (AWS)
Introduction to EC2 (AWS)Introduction to EC2 (AWS)
Introduction to EC2 (AWS)NodeXperts
 
Reactive Application Using METEOR
Reactive Application Using METEORReactive Application Using METEOR
Reactive Application Using METEORNodeXperts
 
Apollo server II
Apollo server IIApollo server II
Apollo server IINodeXperts
 
Apollo Server III
Apollo Server IIIApollo Server III
Apollo Server IIINodeXperts
 
Getting Reactive Data
Getting Reactive DataGetting Reactive Data
Getting Reactive DataNodeXperts
 
State, Life cycle, Methods & Events
State, Life cycle, Methods & Events State, Life cycle, Methods & Events
State, Life cycle, Methods & Events NodeXperts
 
Flow router, components and props
Flow router, components and propsFlow router, components and props
Flow router, components and propsNodeXperts
 
Using react with meteor
Using react with meteorUsing react with meteor
Using react with meteorNodeXperts
 
Introduction to Reactjs
Introduction to ReactjsIntroduction to Reactjs
Introduction to ReactjsNodeXperts
 
Mobile apps using meteor - Part 1
Mobile apps using meteor - Part 1Mobile apps using meteor - Part 1
Mobile apps using meteor - Part 1NodeXperts
 
Microservice architecture : Part 1
Microservice architecture : Part 1Microservice architecture : Part 1
Microservice architecture : Part 1NodeXperts
 
Reactive web applications using MeteorJS
Reactive web applications using MeteorJSReactive web applications using MeteorJS
Reactive web applications using MeteorJSNodeXperts
 
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 webpackNodeXperts
 
Meteor workshop
Meteor workshopMeteor workshop
Meteor workshopNodeXperts
 
Introduction to meteor
Introduction to meteorIntroduction to meteor
Introduction to meteorNodeXperts
 

Plus de NodeXperts (20)

ECMA Script
ECMA ScriptECMA Script
ECMA Script
 
Apollo Server IV
Apollo Server IVApollo Server IV
Apollo Server IV
 
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
 
Apollo server II
Apollo server IIApollo server II
Apollo server II
 
Apollo Server III
Apollo Server IIIApollo Server III
Apollo Server III
 
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
 

Dernier

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Dernier (20)

TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Basics of Apollo Server (GraphQL) - Under 40 Characters

  • 1. Basics of Apollo Server (GraphQL) - By Sumit
  • 2. Topics - What is GraphQL - Why GraphQL - What is Apollo - SDL (Schema Definition Language) - Scalar Types - Resolvers - Operations in GraphQL
  • 3. What is GraphQL? - GraphQL is a query language for API which queries on the data provided to it. - It is not to be confused with Database query language as it is not use to query on database. - The data source for graphQL can be like API, microservices, database.
  • 4. Why GraphQL? ● Ask for what you need and get that data only. Same can be achieved by rest api by it is the core feature of graphQL. ● Returns the data in the same format in which format we request the data. ● Comparatively less request - response cycle compared to rest api, it means you can fetch many resources in single request. ● As GraphQL is strictly typed so, we can catch error during development time and apps is clear about the request and response data. ● GraphQL has a powerful developer tools to test api and documentation.
  • 5. Why GraphQL? Typedef in data type User { name: String! id: Int! friends: [User!]! } Ask what you want { getUser{ name friends { name } } } Format of Response { “getUser”: { name: “John” friends: [{ name: “Alex” },{ name: “Bob” }] } }
  • 6. The team structure of each DAN POD is optimised per set hierarchy What is Apollo? ● Apollo Server is a library use to create the graphQL server in node.js with an ease. ● Apollo Server is a wrapper over the graphQL and provide many inbuilt feature which we have to implement ourselves if we use graphQL with node.js. ● It gives us a feature to combine multiple graphQL server into one by just combining the schema of different server which hides all the complexity in itself and gives us a combined schema. It means that we can easily combine different server into a one and provide a single interaction point for the client. ● It provides us multiple powerful libraries for different use cases like for batch processing of multiple graphql queries it provides libraries apollo-link-batchapollo-link-batch-http, for attempting multiple times in case of server and network error it provides library apollo-link-retry and for more you can refer here.
  • 7. ● The schema syntax we use in graphQL is called SDL. ● SDL represents the relationship between the data returned. ● The schema in the graphQL is stored as a string. type Book { title: String author: Author } type Author { name: String books: [Book] } SDL (Schema Definition Language)
  • 8. Scalar Types in GraphQL Scalar types denotes the leaves of the data. GraphQL has five scalar types mentioned below. ● Int - Signed 32-bit integer ● Float - Signed double-precision floating-point value ● String - UTF-8 character sequence ● Boolean - true/false ● ID - A Unique Identifier
  • 9. Resolvers Resolvers is a method which is responsible for generating the response against the graphql operations. Resovers can return the data or the promise against any operations. Signature of Resolvers ● parent: An object contains the result from the resolvers on the parent type. ● args: An object contains the argument passed during the operations. ● context: An object available to all resolvers and share the state across resolvers. ● info: Information about the execution state of the operations. User: (parent, args, context, info) => response
  • 10. Operations in GraphQL There are 3 types of operations in GraphQL. ● Query: Query operation is just like we use get in http method, it is use to read data from the data provided to graphQL. ● Mutation: Mutation is use if we want to create, delete or update the data. ● Subscription: Subscription is the operation responsible for providing the updated data on each mutation. It means it helps us in achieving reactivity on frontend (Client Side).
  • 11. Important Links: - GraphQL Resource: https://graphql.org/ - Apollo Resource: https://www.apollographql.com/docs/apollo-server/ - GraphQL Schema: https://graphql.org/learn/schema/