Submit Search
Upload
REST API に疲れたあなたへ贈る GraphQL 入門
•
30 likes
•
33,556 views
Keisuke Tsukagoshi
Follow
JJUG CCC 2018 Spring #jjug #jjug_ccc #ccc_e6
Read less
Read more
Technology
Report
Share
Report
Share
1 of 55
Download now
Download to read offline
Recommended
こんなに使える!今どきのAPIドキュメンテーションツール
こんなに使える!今どきのAPIドキュメンテーションツール
dcubeio
Fluentdのお勧めシステム構成パターン
Fluentdのお勧めシステム構成パターン
Kentaro Yoshida
テストとリファクタリングに関する深い方法論 #wewlc_jp
テストとリファクタリングに関する深い方法論 #wewlc_jp
kyon mm
AWSのログ管理ベストプラクティス
AWSのログ管理ベストプラクティス
Akihiro Kuwano
組織にテストを書く文化を根付かせる戦略と戦術
組織にテストを書く文化を根付かせる戦略と戦術
Takuto Wada
Spring CloudとZipkinを利用した分散トレーシング
Spring CloudとZipkinを利用した分散トレーシング
Rakuten Group, Inc.
RESTful Web アプリの設計レビューの話
RESTful Web アプリの設計レビューの話
Takuto Wada
初心者向けWebinar AWSで開発環境を構築しよう
初心者向けWebinar AWSで開発環境を構築しよう
Amazon Web Services Japan
Recommended
こんなに使える!今どきのAPIドキュメンテーションツール
こんなに使える!今どきのAPIドキュメンテーションツール
dcubeio
Fluentdのお勧めシステム構成パターン
Fluentdのお勧めシステム構成パターン
Kentaro Yoshida
テストとリファクタリングに関する深い方法論 #wewlc_jp
テストとリファクタリングに関する深い方法論 #wewlc_jp
kyon mm
AWSのログ管理ベストプラクティス
AWSのログ管理ベストプラクティス
Akihiro Kuwano
組織にテストを書く文化を根付かせる戦略と戦術
組織にテストを書く文化を根付かせる戦略と戦術
Takuto Wada
Spring CloudとZipkinを利用した分散トレーシング
Spring CloudとZipkinを利用した分散トレーシング
Rakuten Group, Inc.
RESTful Web アプリの設計レビューの話
RESTful Web アプリの設計レビューの話
Takuto Wada
初心者向けWebinar AWSで開発環境を構築しよう
初心者向けWebinar AWSで開発環境を構築しよう
Amazon Web Services Japan
テスト文字列に「うんこ」と入れるな
テスト文字列に「うんこ」と入れるな
Kentaro Matsui
「速」を落とさないコードレビュー
「速」を落とさないコードレビュー
Takafumi ONAKA
AWSで作る分析基盤
AWSで作る分析基盤
Yu Otsubo
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
日本マイクロソフト株式会社
実運用して分かったRabbit MQの良いところ・気をつけること #jjug
実運用して分かったRabbit MQの良いところ・気をつけること #jjug
Yahoo!デベロッパーネットワーク
マイクロサービス時代の認証と認可 - AWS Dev Day Tokyo 2018 #AWSDevDay
マイクロサービス時代の認証と認可 - AWS Dev Day Tokyo 2018 #AWSDevDay
都元ダイスケ Miyamoto
実践 NestJS
実践 NestJS
Ayumi Goto
こわくない Git
こわくない Git
Kota Saito
AWSとオンプレミスを繋ぐときに知っておきたいルーティングの基礎知識(CCSI監修!)
AWSとオンプレミスを繋ぐときに知っておきたいルーティングの基礎知識(CCSI監修!)
Trainocate Japan, Ltd.
マイクロサービスにおける 結果整合性との戦い
マイクロサービスにおける 結果整合性との戦い
ota42y
シリコンバレーの「何が」凄いのか
シリコンバレーの「何が」凄いのか
Atsushi Nakada
マイクロにしすぎた結果がこれだよ!
マイクロにしすぎた結果がこれだよ!
mosa siru
Aws amplify studioが変えるフロントエンド開発の未来とは v2
Aws amplify studioが変えるフロントエンド開発の未来とは v2
Koitabashi Yoshitaka
Dockerfile を書くためのベストプラクティス解説編
Dockerfile を書くためのベストプラクティス解説編
Masahito Zembutsu
分散システムについて語らせてくれ
分散システムについて語らせてくれ
Kumazaki Hiroki
ペアプログラミング ホントのところ
ペアプログラミング ホントのところ
Takuto Wada
Apache Airflow入門 (マーケティングデータ分析基盤技術勉強会)
Apache Airflow入門 (マーケティングデータ分析基盤技術勉強会)
Takeshi Mikami
例外設計における大罪
例外設計における大罪
Takuto Wada
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Amazon Web Services Japan
PostgreSQLアンチパターン
PostgreSQLアンチパターン
Soudai Sone
GraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
Nikolas Burk
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB
More Related Content
What's hot
テスト文字列に「うんこ」と入れるな
テスト文字列に「うんこ」と入れるな
Kentaro Matsui
「速」を落とさないコードレビュー
「速」を落とさないコードレビュー
Takafumi ONAKA
AWSで作る分析基盤
AWSで作る分析基盤
Yu Otsubo
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
日本マイクロソフト株式会社
実運用して分かったRabbit MQの良いところ・気をつけること #jjug
実運用して分かったRabbit MQの良いところ・気をつけること #jjug
Yahoo!デベロッパーネットワーク
マイクロサービス時代の認証と認可 - AWS Dev Day Tokyo 2018 #AWSDevDay
マイクロサービス時代の認証と認可 - AWS Dev Day Tokyo 2018 #AWSDevDay
都元ダイスケ Miyamoto
実践 NestJS
実践 NestJS
Ayumi Goto
こわくない Git
こわくない Git
Kota Saito
AWSとオンプレミスを繋ぐときに知っておきたいルーティングの基礎知識(CCSI監修!)
AWSとオンプレミスを繋ぐときに知っておきたいルーティングの基礎知識(CCSI監修!)
Trainocate Japan, Ltd.
マイクロサービスにおける 結果整合性との戦い
マイクロサービスにおける 結果整合性との戦い
ota42y
シリコンバレーの「何が」凄いのか
シリコンバレーの「何が」凄いのか
Atsushi Nakada
マイクロにしすぎた結果がこれだよ!
マイクロにしすぎた結果がこれだよ!
mosa siru
Aws amplify studioが変えるフロントエンド開発の未来とは v2
Aws amplify studioが変えるフロントエンド開発の未来とは v2
Koitabashi Yoshitaka
Dockerfile を書くためのベストプラクティス解説編
Dockerfile を書くためのベストプラクティス解説編
Masahito Zembutsu
分散システムについて語らせてくれ
分散システムについて語らせてくれ
Kumazaki Hiroki
ペアプログラミング ホントのところ
ペアプログラミング ホントのところ
Takuto Wada
Apache Airflow入門 (マーケティングデータ分析基盤技術勉強会)
Apache Airflow入門 (マーケティングデータ分析基盤技術勉強会)
Takeshi Mikami
例外設計における大罪
例外設計における大罪
Takuto Wada
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Amazon Web Services Japan
PostgreSQLアンチパターン
PostgreSQLアンチパターン
Soudai Sone
What's hot
(20)
テスト文字列に「うんこ」と入れるな
テスト文字列に「うんこ」と入れるな
「速」を落とさないコードレビュー
「速」を落とさないコードレビュー
AWSで作る分析基盤
AWSで作る分析基盤
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
【BS13】チーム開発がこんなにも快適に!コーディングもデバッグも GitHub 上で。 GitHub Codespaces で叶えられるシームレスな開発
実運用して分かったRabbit MQの良いところ・気をつけること #jjug
実運用して分かったRabbit MQの良いところ・気をつけること #jjug
マイクロサービス時代の認証と認可 - AWS Dev Day Tokyo 2018 #AWSDevDay
マイクロサービス時代の認証と認可 - AWS Dev Day Tokyo 2018 #AWSDevDay
実践 NestJS
実践 NestJS
こわくない Git
こわくない Git
AWSとオンプレミスを繋ぐときに知っておきたいルーティングの基礎知識(CCSI監修!)
AWSとオンプレミスを繋ぐときに知っておきたいルーティングの基礎知識(CCSI監修!)
マイクロサービスにおける 結果整合性との戦い
マイクロサービスにおける 結果整合性との戦い
シリコンバレーの「何が」凄いのか
シリコンバレーの「何が」凄いのか
マイクロにしすぎた結果がこれだよ!
マイクロにしすぎた結果がこれだよ!
Aws amplify studioが変えるフロントエンド開発の未来とは v2
Aws amplify studioが変えるフロントエンド開発の未来とは v2
Dockerfile を書くためのベストプラクティス解説編
Dockerfile を書くためのベストプラクティス解説編
分散システムについて語らせてくれ
分散システムについて語らせてくれ
ペアプログラミング ホントのところ
ペアプログラミング ホントのところ
Apache Airflow入門 (マーケティングデータ分析基盤技術勉強会)
Apache Airflow入門 (マーケティングデータ分析基盤技術勉強会)
例外設計における大罪
例外設計における大罪
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
Kinesis + Elasticsearchでつくるさいきょうのログ分析基盤
PostgreSQLアンチパターン
PostgreSQLアンチパターン
Similar to REST API に疲れたあなたへ贈る GraphQL 入門
GraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
Nikolas Burk
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB
Graphql usage
Graphql usage
Valentin Buryakov
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
MarcinStachniuk
VBA API for scriptDB primer
VBA API for scriptDB primer
Bruce McPherson
AppSync and GraphQL on iOS
AppSync and GraphQL on iOS
Amazon Web Services
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
VMware Tanzu
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...
François-Guillaume Ribreau
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
apidays
SETCON'18 - Ilya labacheuski - GraphQL adventures
SETCON'18 - Ilya labacheuski - GraphQL adventures
Nadzeya Pus
Introduction to GraphQL and AWS Appsync on AWS - iOS
Introduction to GraphQL and AWS Appsync on AWS - iOS
Amazon Web Services
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Nikolas Burk
GraphQL - an elegant weapon... for more civilized age
GraphQL - an elegant weapon... for more civilized age
Bartosz Sypytkowski
GraphQL the holy contract between client and server
GraphQL the holy contract between client and server
Pavel Chertorogov
Introduction To Groovy 2005
Introduction To Groovy 2005
Tugdual Grall
Overview of GraphQL & Clients
Overview of GraphQL & Clients
Pokai Chang
Node.js: scalability tips - Azure Dev Community Vijayawada
Node.js: scalability tips - Azure Dev Community Vijayawada
Luciano Mammino
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
Amazon Web Services
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
Amazon Web Services
Similar to REST API に疲れたあなたへ贈る GraphQL 入門
(20)
GraphQL & Prisma from Scratch
GraphQL & Prisma from Scratch
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
MongoDB.local Berlin: Building a GraphQL API with MongoDB, Prisma and Typescript
Graphql usage
Graphql usage
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
MongoDB World 2019: Building a GraphQL API with MongoDB, Prisma, & TypeScript
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
VBA API for scriptDB primer
VBA API for scriptDB primer
AppSync and GraphQL on iOS
AppSync and GraphQL on iOS
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
Simplify Access to Data from Pivotal GemFire Using the GraphQL (G2QL) Extension
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...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
APIdays Paris 2018 - Building scalable, type-safe GraphQL servers from scratc...
SETCON'18 - Ilya labacheuski - GraphQL adventures
SETCON'18 - Ilya labacheuski - GraphQL adventures
Introduction to GraphQL and AWS Appsync on AWS - iOS
Introduction to GraphQL and AWS Appsync on AWS - iOS
Managing GraphQL servers with AWS Fargate & Prisma Cloud
Managing GraphQL servers with AWS Fargate & Prisma Cloud
GraphQL - an elegant weapon... for more civilized age
GraphQL - an elegant weapon... for more civilized age
GraphQL the holy contract between client and server
GraphQL the holy contract between client and server
Introduction To Groovy 2005
Introduction To Groovy 2005
Overview of GraphQL & Clients
Overview of GraphQL & Clients
Node.js: scalability tips - Azure Dev Community Vijayawada
Node.js: scalability tips - Azure Dev Community Vijayawada
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
NEW LAUNCH! Realtime and Offline application development using GraphQL with A...
Recently uploaded
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
The Digital Insurer
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
carlostorres15106
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Pixlogix Infotech
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Alfredo García Lavilla
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Fwdays
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
null - The Open Security Community
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
Mark Billinghurst
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
2toLead Limited
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
NavinnSomaal
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
Miki Katsuragi
costume and set research powerpoint presentation
costume and set research powerpoint presentation
phoebematthew05
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
hariprasad279825
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April Automation LPDG
MarianaLemus7
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
Dubai Multi Commodity Centre
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Fwdays
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
BookNet Canada
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Rizwan Syed
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
shyamraj55
Recently uploaded
(20)
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
costume and set research powerpoint presentation
costume and set research powerpoint presentation
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April Automation LPDG
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
REST API に疲れたあなたへ贈る GraphQL 入門
1.
Amazon Web Services
Japan Tsukagoshi Keisuke REST API GraphQL JJUG CCC 2018 Spring #ccc_e6
2.
Who am I
? e gd B A @ Mobile / DevOps / Serverless W SJ ba W J c S=
3.
Overview c G E E
R Q Aa A G I G I G S T Q LPR I We G
4.
GraphQL
5.
GraphQL ? • GraphQL
API TypeSystem • GraphQL
6.
GraphQL -REST API
- • REST API • API • API • API • • API • Request / Response
7.
GraphQL • , • • API •
API
8.
GraphQL – GraphQL
- • P ) A • A ) B A C • A I B A P )
9.
GraphQL – GraphQL
- • P ) A • A ) B A C • A I B A P )
10.
! type Todo { id:
ID! name: String description: String status: TodoStatus } type Query { getTodos: [Todo] } enum TodoStatus { done pending } A N I S D )
11.
)
12.
)
13.
) ) PL • La
G p - G PL G P hp r I C P P • I C P P G B - P G QI • I A QG P I -I G
14.
) { "id": "1", "name": "Get
Milk", “priority": "1" }, { "id": “2", "name": “Go to gym", “priority": “5" },… type Query { getTodos: [Todo] } type Todo { id: ID! name: String description: String priority: Int duedate: String } query { getTodos { id name priority } }
15.
) != Graph database NoSQL,
Relational, HTTP, etc. GraphQL /posts /postInfo /postJustTitle /postsByAuthor /postNameStartsWithX /commentsOnPost
16.
) ) PL • La
G p - G PL G P hp r I C P P • I C P P G B - P G QI • I A QG P I -I G
17.
) Mutation - mutation addPost( id:123 title:”New
post!” author:”Nadia”){ id title author } data: [{ id:123, title:”New Post!” author:”Nadia” }]
18.
type Subscription { addedPost:
Post @aws_subscribe(mutations: ["addPost"]) deletedPost: Post @aws_subscribe(mutations: ["deletePost"]) } type Mutation { addPost(id: ID! author: String! title: String content: String): Post! deletePost(id: ID!): Post! } subscription NewPostSub { addedPost { __typename version title content author url } }
19.
) ) Subscription NewPostSub
{ addedPost{…} } WebSocket URL and Connection Payload Secure Websocket Connection (wss://)
20.
const AllPostsWithData =
compose( graphql(AllPostsQuery, { options: { fetchPolicy: 'cache-and-network‘ }, props: (props) => ({ posts: props.data.posts, subscribeToNewPosts: params => { props.data.subscribeToMore({ document: NewPostsSubscription, updateQuery: (prev, { subscriptionData: { newPost } }) => ({ ...prev, posts: [newPost, ...prev.posts.filter(post => post.id !== newPost.id)] }) }); }); …//more code )
21.
Demo:
22.
AppSync
23.
AWS AppSync GraphQL GraphQL
24.
• • • • • • • • • • Sync
25.
AppSync • • • • • • •
26.
AppSync Overview AWS AppSync Amazon DynamoDB AWS Lambda ElasticSearch
27.
dynamoDB AmazonES Amazon DynamoDB ElasticSearch e.t.c
28.
Lambda 3rdPartyAPI Lambda DataSource WebAPI
29.
30.
31.
32.
AWS AppSync Amazon DynamoDB AWS Lambda ElasticSearch
33.
• • GraphQL API
1 GraphQL SDL(Schema Definition Language)
34.
schema { query:Query mutation: Mutation subscription:
Subscription } Query : Mutation : Subscription :
35.
type Query { getTodos:
[Todo] } type Todo { id: ID! name: String description: String status: TodoStatus } enum TodoStatus { done pending } Not Null ID! [String!]
36.
Resolver Mapping Template
37.
AppSync Overview AWS AppSync Amazon DynamoDB AWS Lambda ElasticSearch
38.
• GraphQL GraphQL • Apache
Velocity Template Language VTL • • https://docs.aws.amazon.com/appsync/latest/devguide/resolver- mapping-template-reference-programming-guide.html
39.
• • • • • • ID / •
40.
• •
41.
: { "version" : "2017-02-28", "operation"
: "GetItem", "key" : { "id" : { "S" : "${context.arguments.id}" } } }
42.
: $utils.toJson($context.result) { "id" : ${context.data.id}, "title"
: "${context.data.theTitle}", "content" : "${context.data.body1} ${context.data.body2}" }
43.
44.
DynamoDB
45.
46.
AppSync Overview AWS AppSync Amazon DynamoDB AWS Lambda ElasticSearch
47.
GraphQL Endpoint export default
{ "graphqlEndpoint": "https://**.appsync-api.**.amazonaws.com/graphql", "region": "us-east-1", "authenticationType": "API_KEY", "apiKey": ”***" }
48.
Client const client =
new AWSAppSyncClient({ url: awsconfig.ENDPOINT, region: AWS.config.region, auth: { type: AUTH_TYPE.AWS_IAM, credentials: Auth.currentCredentials() } }); const WithProvider = () => ( <ApolloProvider client={client}> <Rehydrated> <AppWithData /> </Rehydrated> </ApolloProvider> ); https://aws.github.io/aws-amplify/
49.
Client //API Key const client
= new AWSAppSyncClient({ url: awsconfig.ENDPOINT, region: awsconfig.REGION, auth: { type: AUTH_TYPE.API_KEY, apiKey: awsconfig.apiKey} });
50.
Client //IAM auth: { type:
AUTH_TYPE.AWS_IAM, credentials: Auth.currentCredentials() } //Cognito User Pool auth: { type: AUTH_TYPE.AMAZON_COGNITO_USER_POOLS, jwtToken: Auth.currentSession().accessToke.jwtToken }
51.
Demo: GraphQL
52.
• AWS AppSync
GraphQL Photo Sample • https://github.com/aws-samples/aws-amplify-graphql • GraphQL starter application • https://github.com/aws-samples/aws-mobile-appsync- events-starter-react
53.
AWS AppSync GraphQL
Photo Sample
54.
B • B B ) C •
C ) A I I P C • C P C P P )
55.
Happy coding with
AppSync! AWS AppSync Amazon DynamoDB AWS Lambda ElasticSearch AWS AppSync GraphQL API
Download now