Submit Search
Upload
REST API に疲れたあなたへ贈る GraphQL 入門
•
30 likes
•
33,545 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
Redisの特徴と活用方法について
Redisの特徴と活用方法について
Yuji Otani
MongoDBが遅いときの切り分け方法
MongoDBが遅いときの切り分け方法
Tetsutaro Watanabe
爆速クエリエンジン”Presto”を使いたくなる話
爆速クエリエンジン”Presto”を使いたくなる話
Kentaro Yoshida
Python 3.9からの新定番zoneinfoを使いこなそう
Python 3.9からの新定番zoneinfoを使いこなそう
Ryuji Tsutsui
SPAセキュリティ入門~PHP Conference Japan 2021
SPAセキュリティ入門~PHP Conference Japan 2021
Hiroshi Tokumaru
At least onceってぶっちゃけ問題の先送りだったよね #kafkajp
At least onceってぶっちゃけ問題の先送りだったよね #kafkajp
Yahoo!デベロッパーネットワーク
本当は恐ろしい分散システムの話
本当は恐ろしい分散システムの話
Kumazaki Hiroki
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
[Aurora事例祭り]Amazon Aurora を使いこなすためのベストプラクティス
Amazon Web Services Japan
More Related Content
What's hot
MHA for MySQLとDeNAのオープンソースの話
MHA for MySQLとDeNAのオープンソースの話
Yoshinori Matsunobu
Mavenの真実とウソ
Mavenの真実とウソ
Yoshitaka Kawashima
とある診断員とSQLインジェクション
とある診断員とSQLインジェクション
zaki4649
PlaySQLAlchemy: SQLAlchemy入門
PlaySQLAlchemy: SQLAlchemy入門
泰 増田
ソーシャルゲームのためのデータベース設計
ソーシャルゲームのためのデータベース設計
Yoshinori Matsunobu
AWS Glueを使った Serverless ETL の実装パターン
AWS Glueを使った Serverless ETL の実装パターン
seiichi arai
マイクロサービスバックエンドAPIのためのRESTとgRPC
マイクロサービスバックエンドAPIのためのRESTとgRPC
disc99_
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
Kouhei Sutou
ログ管理のベストプラクティス
ログ管理のベストプラクティス
Akihiro Kuwano
[GKE & Spanner 勉強会] Cloud Spanner の技術概要
[GKE & Spanner 勉強会] Cloud Spanner の技術概要
Google Cloud Platform - Japan
TDDBC お題
TDDBC お題
Takuto Wada
ゲームエンジニアのためのデータベース設計
ゲームエンジニアのためのデータベース設計
sairoutine
PHP-FPM の子プロセス制御方法と設定をおさらいしよう
PHP-FPM の子プロセス制御方法と設定をおさらいしよう
Shohei Okada
nginx入門
nginx入門
Takashi Takizawa
40分でわかるHadoop徹底入門 (Cloudera World Tokyo 2014 講演資料)
40分でわかるHadoop徹底入門 (Cloudera World Tokyo 2014 講演資料)
hamaken
トランザクションスクリプトのすすめ
トランザクションスクリプトのすすめ
pospome
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門
Etsuji Nakai
分散トレーシング技術について(Open tracingやjaeger)
分散トレーシング技術について(Open tracingやjaeger)
NTT Communications Technology Development
例外設計における大罪
例外設計における大罪
Takuto Wada
忙しい人の5分で分かるMesos入門 - Mesos って何だ?
忙しい人の5分で分かるMesos入門 - Mesos って何だ?
Masahito Zembutsu
What's hot
(20)
MHA for MySQLとDeNAのオープンソースの話
MHA for MySQLとDeNAのオープンソースの話
Mavenの真実とウソ
Mavenの真実とウソ
とある診断員とSQLインジェクション
とある診断員とSQLインジェクション
PlaySQLAlchemy: SQLAlchemy入門
PlaySQLAlchemy: SQLAlchemy入門
ソーシャルゲームのためのデータベース設計
ソーシャルゲームのためのデータベース設計
AWS Glueを使った Serverless ETL の実装パターン
AWS Glueを使った Serverless ETL の実装パターン
マイクロサービスバックエンドAPIのためのRESTとgRPC
マイクロサービスバックエンドAPIのためのRESTとgRPC
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
MySQL・PostgreSQLだけで作る高速あいまい全文検索システム
ログ管理のベストプラクティス
ログ管理のベストプラクティス
[GKE & Spanner 勉強会] Cloud Spanner の技術概要
[GKE & Spanner 勉強会] Cloud Spanner の技術概要
TDDBC お題
TDDBC お題
ゲームエンジニアのためのデータベース設計
ゲームエンジニアのためのデータベース設計
PHP-FPM の子プロセス制御方法と設定をおさらいしよう
PHP-FPM の子プロセス制御方法と設定をおさらいしよう
nginx入門
nginx入門
40分でわかるHadoop徹底入門 (Cloudera World Tokyo 2014 講演資料)
40分でわかるHadoop徹底入門 (Cloudera World Tokyo 2014 講演資料)
トランザクションスクリプトのすすめ
トランザクションスクリプトのすすめ
Linux女子部 systemd徹底入門
Linux女子部 systemd徹底入門
分散トレーシング技術について(Open tracingやjaeger)
分散トレーシング技術について(Open tracingやjaeger)
例外設計における大罪
例外設計における大罪
忙しい人の5分で分かるMesos入門 - Mesos って何だ?
忙しい人の5分で分かるMesos入門 - Mesos って何だ?
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
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdf
Anna Loughnan Colquhoun
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
Adam Moalla
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
DianaGray10
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
Renan Moreira de Oliveira
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
Mahmoud Rabie
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
UiPathCommunity
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
DianaGray10
Designing A Time bound resource download URL
Designing A Time bound resource download URL
Runcy Oommen
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
DianaGray10
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
Adtran
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
DianaGray10
Introduction to Quantum Computing
Introduction to Quantum Computing
GDSC PJATK
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
DianaGray10
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
D Cloud Solutions
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Aijun Zhang
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
Udaiappa Ramachandran
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
Daniel Santiago Silva Capera
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation Inc
Object Automation
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
Md Hossain Ali
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IES VE
Recently uploaded
(20)
Spring24-Release Overview - Wellingtion User Group-1.pdf
Spring24-Release Overview - Wellingtion User Group-1.pdf
9 Steps For Building Winning Founding Team
9 Steps For Building Winning Founding Team
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
PicPay - GenAI Finance Assistant - ChatGPT for Customer Service
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
Designing A Time bound resource download URL
Designing A Time bound resource download URL
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
Introduction to Quantum Computing
Introduction to Quantum Computing
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
RAG Patterns and Vector Search in Generative AI
RAG Patterns and Vector Search in Generative AI
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
GenAI and AI GCC State of AI_Object Automation Inc
GenAI and AI GCC State of AI_Object Automation Inc
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
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
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}" }
44.
DynamoDB
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