SlideShare a Scribd company logo
1 of 26
Download to read offline
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: {
๏ฌrstName: โ€œ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 o๏ฌ„ine 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

More Related Content

What's hot

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
ย 

What's hot (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
ย 

Similar to Serverless GraphQL with AWS AppSync & AWS Amplify

Similar to 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
ย 

More from Kentucky JavaScript Users Group

More from 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
ย 

Recently uploaded

VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
SUHANI PANDEY
ย 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
SUHANI PANDEY
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
imonikaupta
ย 
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
ย 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
SUHANI PANDEY
ย 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
SUHANI PANDEY
ย 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
ย 
โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...
โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...
โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...
Diya Sharma
ย 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
ย 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
SUHANI PANDEY
ย 

Recently uploaded (20)

VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
ย 
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Katraj ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Katraj ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
ย 
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund โŸŸ 6297143586 โŸŸ Call Me For Genuine Sex Servi...
ย 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
ย 
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort ServiceEnjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
Enjoy NightโšกCall Girls Dlf City Phase 3 Gurgaon >เผ’8448380779 Escort Service
ย 
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRLLucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
Lucknow โคCALL GIRL 88759*99948 โคCALL GIRLS IN Lucknow ESCORT SERVICEโคCALL GIRL
ย 
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort ServiceCall Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
Call Girls in Prashant Vihar, Delhi ๐Ÿ’ฏ Call Us ๐Ÿ”9953056974 ๐Ÿ” Escort Service
ย 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
ย 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
ย 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
ย 
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
ย 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
ย 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
ย 
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
ย 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
ย 
โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...
โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...
โ‚น5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] ๐Ÿ”|97111...
ย 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
ย 
Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now โ˜Ž 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
ย 
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
ย 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
ย 

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: { ๏ฌrstName: โ€œ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 o๏ฌ„ine 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