SlideShare une entreprise Scribd logo
1  sur  26
Télécharger pour lire hors ligne
Serverless GraphQL
Using AWS APPSync and AWS Amplify
Bill Kidwell
KY JavaScript User’s Group
Hello!
I am Bill Kidwell
I have 22 years in the software industry
I have a graduate degree from UK with a Software
Engineering emphasis
I like to coach, mentor, and teach developers
2
Agenda
▫ Part I
▫ Define GraphQL
▫ Potential Advantages
▫ Part II
▫ Understand queries, mutations
▫ Understand schema and resolvers
▫ Part III
▫ AppSync and Amplify will make this easy
▫ Hand-On Example 3
“
GraphQL
A query language for your api
4
The GraphQL Experience
5
Get predictable results
{
"project": {
"tagline": "A query language for APIs"
}
}
Describe your data
type Project {
name: String
tagline: String
contributors: [User]
}
Ask for what you want
{
project(name: "GraphQL") {
tagline
}
}
Rest API Request/Response
GET /api/user =>
user: {
firstName: “Billy”,
lastName: “Kidwell”,
gender: “male”,
createAt: “2019-08-27T18:04:31”,
updatedAt: “2019-08-27T18:04:31”,
posts: [ ]
}
You get what you get… (no overfetching)
GraphQL Query and response
user {
firstName
lastName
gender
}
=> user: {
firstName: “Billy”,
lastName: “Kidwell”,
gender: “male”
}
6
No Underfetching
REST
To populate the author object
/ps /author/<id>
/ps /author/<id>/courses
/ps /author/<id>/rating
/ps /author/<id>/topics
The GraphQL Query
{
author (id: 2100) {
name
courses {
title
}
rating
topics (last: 3) {
name
}
}
}
7
Strongly Typed Schema
▫ Eases validation, documentation
▫ Find errors earlier
▫ Serves as contract between client and server
▫ Frontend and backend teams can work
independently
▫ Enables a robust toolset
8
The Parts of GraphQL
Queries, Mutations, Schemas and Resolvers
10
Pokemon Type
10
! Not nullable
Standard Types
Custom Types
[ ] Array
Queries and
Fragments
Use fragments for reusable
parts.
Name your queries. They can
include parameters.
11
query first50Pokemons {
pokemons(first: 50) {
...pokemonInfo
}
}
fragment pokemonInfo on Pokemon{
name
number
classification
maxCP
maxHP
image
}
Mutations
Create,
Update &
Delete
data
12
type Mutation {
addPokemon(
name: String,
number: String
):
Pokemon
}
“
13
Resolvers provide the instructions for turning a GraphQL
operation (a query, mutation, or subscription) into data.
type Query {
greeting: String
students: [Student]
studentById(id:ID!): Student
}
14
A sample schema
type Student {
id: ID!
firstName: String
lastName: String
password: String
collegeId: String
}
A Sample Resolver
const db = require('./db')
const Query = {
//resolver function for greeting
greeting:() => {
return "hello from TutorialsPoint !!!"
},
15
//resolver function for students returns list
students:() => db.students.list(),
//resolver function for studentbyId
studentById:(root,args,context,info) => {
//args will contain parameter passed in query
return db.students.get(args.id);
}
}
module.exports = {Query}
AWS Tools
Using AWS AppSync & AWS
Amplify to make this easier
16
17
AWS AppSync
Build scalable applications
on a range of data sources,
including those requiring real-
time updates and offline data
access
AWS AppSync
18
19
AWS Amplify
● Manage cloud services
● Manage environments
● GraphQL Transform
● GraphQL CodeGen
20
GraphQL Transform - @model
$ amplify add api # schema.graphql
type Post @model {
id: ID!
title: String!
}
Our process is easy
21
Implement Iteratively
Order them considering
simplicity and dependencies
(e.g. create before list, update or
delete)
Work through them iteratively.
Data Model
Start with a Data Model
Document Data Access Patterns
NoSQL databases require
special attention to data access
patterns. If you don’t know
what these are going to be, you
might want to go with a
relational database.
22
Consider this example data model
23
For our Sample Blog, Consider
Create a Blog
List all Blogs
Add a Post to a Blog
Get all Posts for the Blog
Create a Comment on a Post
Get a Post and All Comments for the Blog
Demo Time!
Hold my beer!
Questions?
25
26
Thanks!Any questions?
You can find me at
@billyrkidwell & kidwell.bill@gmail.com

Contenu connexe

Tendances

Build Android App using GCE & GAE
Build Android App using GCE & GAEBuild Android App using GCE & GAE
Build Android App using GCE & GAE
Love Sharma
 

Tendances (20)

Building a GraphQL API in PHP
Building a GraphQL API in PHPBuilding a GraphQL API in PHP
Building a GraphQL API in PHP
 
Modular GraphQL with Schema Stitching
Modular GraphQL with Schema StitchingModular GraphQL with Schema Stitching
Modular GraphQL with Schema Stitching
 
GraphQL Search
GraphQL SearchGraphQL Search
GraphQL Search
 
GraphQL
GraphQLGraphQL
GraphQL
 
GraphQL, Redux, and React
GraphQL, Redux, and ReactGraphQL, Redux, and React
GraphQL, Redux, and React
 
An intro to GraphQL
An intro to GraphQLAn intro to GraphQL
An intro to GraphQL
 
Adding GraphQL to your existing architecture
Adding GraphQL to your existing architectureAdding GraphQL to your existing architecture
Adding GraphQL to your existing architecture
 
Build Android App using GCE & GAE
Build Android App using GCE & GAEBuild Android App using GCE & GAE
Build Android App using GCE & GAE
 
GraphQL Fundamentals
GraphQL FundamentalsGraphQL Fundamentals
GraphQL Fundamentals
 
Introduction to GraphQL at API days
Introduction to GraphQL at API daysIntroduction to GraphQL at API days
Introduction to GraphQL at API days
 
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
 
Intro to GraphQL
 Intro to GraphQL Intro to GraphQL
Intro to GraphQL
 
Introduction to graphQL
Introduction to graphQLIntroduction to graphQL
Introduction to graphQL
 
GraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer toolsGraphQL: Enabling a new generation of API developer tools
GraphQL: Enabling a new generation of API developer tools
 
Into to GraphQL
Into to GraphQLInto to GraphQL
Into to GraphQL
 
Getting started with GraphQL
Getting started with GraphQLGetting started with GraphQL
Getting started with GraphQL
 
REST vs GraphQL
REST vs GraphQLREST vs GraphQL
REST vs GraphQL
 
The State of the Developer Ecosystem - .NET Conf Madrid 2018
The State of the Developer Ecosystem - .NET Conf Madrid 2018The State of the Developer Ecosystem - .NET Conf Madrid 2018
The State of the Developer Ecosystem - .NET Conf Madrid 2018
 
Graphql
GraphqlGraphql
Graphql
 
GraphQL in an Age of REST
GraphQL in an Age of RESTGraphQL in an Age of REST
GraphQL in an Age of REST
 

Similaire à Serverless GraphQL with AWS AppSync & AWS Amplify

Similaire à Serverless GraphQL with AWS AppSync & AWS Amplify (20)

Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or ServerlessYour API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
Your API on Steroids - Retrofitting GraphQL by Code, Cloud Native or Serverless
 
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) ExtensionSimplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
 
GraphQL the holy contract between client and server
GraphQL the holy contract between client and serverGraphQL the holy contract between client and server
GraphQL the holy contract between client and server
 
Graphql usage
Graphql usageGraphql usage
Graphql usage
 
GraphQL
GraphQLGraphQL
GraphQL
 
GraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database accessGraphQL and its schema as a universal layer for database access
GraphQL and its schema as a universal layer for database access
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
GraphQL & Prisma from Scratch
GraphQL & Prisma from ScratchGraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
 
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScriptMongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
 
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers  with AWS Fargate & Prisma CloudManaging GraphQL servers  with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
 
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and TypescriptMongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
 
Serverless GraphQL for Product Developers
Serverless GraphQL for Product DevelopersServerless GraphQL for Product Developers
Serverless GraphQL for Product Developers
 
The API Journey: GraphQL Specification and Implementation
The API Journey: GraphQL Specification and ImplementationThe API Journey: GraphQL Specification and Implementation
The API Journey: GraphQL Specification and Implementation
 
Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)Camunda GraphQL Extension (09/2017 Berlin)
Camunda GraphQL Extension (09/2017 Berlin)
 
Overview of GraphQL & Clients
Overview of GraphQL & ClientsOverview of GraphQL & Clients
Overview of GraphQL & Clients
 
APIdays Helsinki 2019 - GraphQL API Management with Amit P. Acharya, IBM
APIdays Helsinki 2019 - GraphQL API Management with Amit P. Acharya, IBMAPIdays Helsinki 2019 - GraphQL API Management with Amit P. Acharya, IBM
APIdays Helsinki 2019 - GraphQL API Management with Amit P. Acharya, IBM
 
Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)
Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)
Shift Remote: WEB - GraphQL and React – Quick Start - Dubravko Bogovic (Infobip)
 
APIdays Helsinki 2019 - Beyond REST: GraphQL API Management with Amit Acharya...
APIdays Helsinki 2019 - Beyond REST: GraphQL API Management with Amit Acharya...APIdays Helsinki 2019 - Beyond REST: GraphQL API Management with Amit Acharya...
APIdays Helsinki 2019 - Beyond REST: GraphQL API Management with Amit Acharya...
 
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
How to grow GraphQL and remove SQLAlchemy and REST API from a high-load Pytho...
 
GraphQL 101
GraphQL 101GraphQL 101
GraphQL 101
 

Plus de Kentucky JavaScript Users Group

Plus de Kentucky JavaScript Users Group (9)

CQRS and Event Sourcing
CQRS and Event SourcingCQRS and Event Sourcing
CQRS and Event Sourcing
 
A Rubyist Tries AngularJS
A Rubyist Tries AngularJSA Rubyist Tries AngularJS
A Rubyist Tries AngularJS
 
Intro to Three.js
Intro to Three.jsIntro to Three.js
Intro to Three.js
 
PhoneGap - JavaScript for Mobile Apps
PhoneGap - JavaScript for Mobile AppsPhoneGap - JavaScript for Mobile Apps
PhoneGap - JavaScript for Mobile Apps
 
An Intro to AngularJS
An Intro to AngularJSAn Intro to AngularJS
An Intro to AngularJS
 
Node and SocketIO
Node and SocketIONode and SocketIO
Node and SocketIO
 
Node.js Introduction
Node.js IntroductionNode.js Introduction
Node.js Introduction
 
Underscore and Backbone Models
Underscore and Backbone ModelsUnderscore and Backbone Models
Underscore and Backbone Models
 
JavaScript State of the Union - Jan 2013
JavaScript State of the Union - Jan 2013JavaScript State of the Union - Jan 2013
JavaScript State of the Union - Jan 2013
 

Dernier

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
ayvbos
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
pxcywzqs
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Monica Sydney
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
ydyuyu
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
ayvbos
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
F
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 

Dernier (20)

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call GirlsMira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
Mira Road Housewife Call Girls 07506202331, Nalasopara Call Girls
 
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Dindigul [ 7014168258 ] Call Me For Genuine Models ...
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
原版制作美国爱荷华大学毕业证(iowa毕业证书)学位证网上存档可查
 
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
一比一原版(Flinders毕业证书)弗林德斯大学毕业证原件一模一样
 
一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理一比一原版奥兹学院毕业证如何办理
一比一原版奥兹学院毕业证如何办理
 
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime BalliaBallia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
Ballia Escorts Service Girl ^ 9332606886, WhatsApp Anytime Ballia
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 

Serverless GraphQL with AWS AppSync & AWS Amplify

  • 1. Serverless GraphQL Using AWS APPSync and AWS Amplify Bill Kidwell KY JavaScript User’s Group
  • 2. Hello! I am Bill Kidwell I have 22 years in the software industry I have a graduate degree from UK with a Software Engineering emphasis I like to coach, mentor, and teach developers 2
  • 3. Agenda ▫ Part I ▫ Define GraphQL ▫ Potential Advantages ▫ Part II ▫ Understand queries, mutations ▫ Understand schema and resolvers ▫ Part III ▫ AppSync and Amplify will make this easy ▫ Hand-On Example 3
  • 5. The GraphQL Experience 5 Get predictable results { "project": { "tagline": "A query language for APIs" } } Describe your data type Project { name: String tagline: String contributors: [User] } Ask for what you want { project(name: "GraphQL") { tagline } }
  • 6. Rest API Request/Response GET /api/user => user: { firstName: “Billy”, lastName: “Kidwell”, gender: “male”, createAt: “2019-08-27T18:04:31”, updatedAt: “2019-08-27T18:04:31”, posts: [ ] } You get what you get… (no overfetching) GraphQL Query and response user { firstName lastName gender } => user: { firstName: “Billy”, lastName: “Kidwell”, gender: “male” } 6
  • 7. No Underfetching REST To populate the author object /ps /author/<id> /ps /author/<id>/courses /ps /author/<id>/rating /ps /author/<id>/topics The GraphQL Query { author (id: 2100) { name courses { title } rating topics (last: 3) { name } } } 7
  • 8. Strongly Typed Schema ▫ Eases validation, documentation ▫ Find errors earlier ▫ Serves as contract between client and server ▫ Frontend and backend teams can work independently ▫ Enables a robust toolset 8
  • 9. The Parts of GraphQL Queries, Mutations, Schemas and Resolvers
  • 10. 10 Pokemon Type 10 ! Not nullable Standard Types Custom Types [ ] Array
  • 11. Queries and Fragments Use fragments for reusable parts. Name your queries. They can include parameters. 11 query first50Pokemons { pokemons(first: 50) { ...pokemonInfo } } fragment pokemonInfo on Pokemon{ name number classification maxCP maxHP image }
  • 12. Mutations Create, Update & Delete data 12 type Mutation { addPokemon( name: String, number: String ): Pokemon }
  • 13. “ 13 Resolvers provide the instructions for turning a GraphQL operation (a query, mutation, or subscription) into data.
  • 14. type Query { greeting: String students: [Student] studentById(id:ID!): Student } 14 A sample schema type Student { id: ID! firstName: String lastName: String password: String collegeId: String }
  • 15. A Sample Resolver const db = require('./db') const Query = { //resolver function for greeting greeting:() => { return "hello from TutorialsPoint !!!" }, 15 //resolver function for students returns list students:() => db.students.list(), //resolver function for studentbyId studentById:(root,args,context,info) => { //args will contain parameter passed in query return db.students.get(args.id); } } module.exports = {Query}
  • 16. AWS Tools Using AWS AppSync & AWS Amplify to make this easier 16
  • 17. 17 AWS AppSync Build scalable applications on a range of data sources, including those requiring real- time updates and offline data access
  • 19. 19 AWS Amplify ● Manage cloud services ● Manage environments ● GraphQL Transform ● GraphQL CodeGen
  • 20. 20 GraphQL Transform - @model $ amplify add api # schema.graphql type Post @model { id: ID! title: String! }
  • 21. Our process is easy 21 Implement Iteratively Order them considering simplicity and dependencies (e.g. create before list, update or delete) Work through them iteratively. Data Model Start with a Data Model Document Data Access Patterns NoSQL databases require special attention to data access patterns. If you don’t know what these are going to be, you might want to go with a relational database.
  • 23. 23 For our Sample Blog, Consider Create a Blog List all Blogs Add a Post to a Blog Get all Posts for the Blog Create a Comment on a Post Get a Post and All Comments for the Blog
  • 26. 26 Thanks!Any questions? You can find me at @billyrkidwell & kidwell.bill@gmail.com