A QUICK INTRODUCTION TO GRAPHQL
ASHOKKUMAR T.A. | 25-MAR-20201
WHAT IS GRAPHQL
 A query language for APIs
 Created at Facebook in 2012 & open sourced in 2015
 Specification, many implementations in multiple languages
 Specs at http://spec.graphql.org/
 GraphQL Foundation – neutral body to promote widespread adoption
WHY GRAPHQL
 Less chatty
 Client chooses the fields it needs, tailor made response
 API evolution without versioning
 Rapid development
 Best for microservices – combine multiple APIs, pick only the needed fields
GRAPHQL VS. REST
Response
Specific vs. Standard
Architecture
Client Driven vs. Resource oriented
URLs
Single POST URL vs Resource based
Language
Query/Mutation vs. GET/POST/PUT/DELETE
Eco-system
Fast growing vs. Well estabilished
UNDERSTANDING GRAPHQL ARCHITECTURE
BASIC BUILDING BLOCKS
 Types
 Schema
 Queries
 Mutations
 Resolvers
 Client
GETTING STARTED – WELCOME & GREET API’S
 App with 2 APIs – welcome & greet
 GraphQL.js
 With Express GraphQL Server
 Query APIs – welcome & greet
 Implementing the resolvers
 Putting it all together
 GraphiQL Client
DEMO
 Multiple API calls in one request, response controlled from client
 OOB parameter validations, API documentation
 Demo code can be downloaded from https://github.com/ashokkumarta/graphql-samples/tree/main/01
DIGGING IN FURTHER
 Mock the training schedule
 Types
 Student
 Course
 Training
 Schema definition is the key
DEMO
 User defined types & conditions
 Selection of attributes needed in the response dictated by client
 Demo code can be downloaded from https://github.com/ashokkumarta/graphql-samples/tree/main/02
DISCUSSION
THANKYOU
Feedback and suggestions welcome.
Please write to ashokkumar.ta@gmail.com

A quick introduction to GraphQL

  • 1.
    A QUICK INTRODUCTIONTO GRAPHQL ASHOKKUMAR T.A. | 25-MAR-20201
  • 2.
    WHAT IS GRAPHQL A query language for APIs  Created at Facebook in 2012 & open sourced in 2015  Specification, many implementations in multiple languages  Specs at http://spec.graphql.org/  GraphQL Foundation – neutral body to promote widespread adoption
  • 3.
    WHY GRAPHQL  Lesschatty  Client chooses the fields it needs, tailor made response  API evolution without versioning  Rapid development  Best for microservices – combine multiple APIs, pick only the needed fields
  • 4.
    GRAPHQL VS. REST Response Specificvs. Standard Architecture Client Driven vs. Resource oriented URLs Single POST URL vs Resource based Language Query/Mutation vs. GET/POST/PUT/DELETE Eco-system Fast growing vs. Well estabilished
  • 5.
  • 6.
    BASIC BUILDING BLOCKS Types  Schema  Queries  Mutations  Resolvers  Client
  • 7.
    GETTING STARTED –WELCOME & GREET API’S  App with 2 APIs – welcome & greet  GraphQL.js  With Express GraphQL Server  Query APIs – welcome & greet  Implementing the resolvers  Putting it all together  GraphiQL Client
  • 8.
    DEMO  Multiple APIcalls in one request, response controlled from client  OOB parameter validations, API documentation  Demo code can be downloaded from https://github.com/ashokkumarta/graphql-samples/tree/main/01
  • 9.
    DIGGING IN FURTHER Mock the training schedule  Types  Student  Course  Training  Schema definition is the key
  • 10.
    DEMO  User definedtypes & conditions  Selection of attributes needed in the response dictated by client  Demo code can be downloaded from https://github.com/ashokkumarta/graphql-samples/tree/main/02
  • 11.
  • 12.
    THANKYOU Feedback and suggestionswelcome. Please write to ashokkumar.ta@gmail.com