Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
5分で分かった気になれるGraphQLの話
Search
starling888888
November 23, 2019
Programming
1
370
5分で分かった気になれるGraphQLの話
2019-11-23 に行われたDevfest in 信州2019 のLTで発表したスライド
starling888888
November 23, 2019
Tweet
Share
More Decks by starling888888
See All by starling888888
明日から使おうGitLab入門
ryouehara
0
900
Other Decks in Programming
See All in Programming
スキーマ駆動で、Zod OpenAPI Honoによる、API開発するために、Hono Takibiというライブラリを作っている
nakita628
0
320
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
890
Reactive Thinking with Signals and the Resource API
manfredsteyer
PRO
0
110
3年ぶりにコードを書いた元CTOが Claude Codeと30分でMVPを作った話
maikokojima
0
630
SwiftDataを使って10万件のデータを読み書きする
akidon0000
0
240
Foundation Modelsを実装日本語学習アプリを作ってみた!
hypebeans
1
130
AI 駆動開発におけるコミュニティと AWS CDK の価値
konokenj
5
240
その面倒な作業、「Dart」にやらせませんか? Flutter開発者のための業務効率化
yordgenome03
1
140
マンガアプリViewerの大画面対応を考える
kk__777
0
250
One Enishi After Another
snoozer05
PRO
0
160
Webサーバーサイド言語としてのRustについて
kouyuume
1
4.9k
Google Opalで使える37のライブラリ
mickey_kubo
3
140
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
38
2.9k
The Language of Interfaces
destraynor
162
25k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
30
2.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
640
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Embracing the Ebb and Flow
colly
88
4.9k
Navigating Team Friction
lara
190
15k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
253
22k
Music & Morning Musume
bryan
46
6.9k
Transcript
5分で分かった気になれる GraphQLの話 2019-11-23 on Devfest in 信州2019
whoami? Ryo Uehara(@starling8+) ▪ 県内某社のWebエンジニア(新米) ▪ DockerとNodeJSがメインスタック ▪ プライベートではUbuntuとHaskellい じってる
▪ アカウントの8の数は使ってるサービス で変わります 2
1 What is GraphQL? 3
What is GraphQL? 4 ▪ ポストRESTAPIとして注目されているWebAPIの規格 ▪ ネストしたリソースやRESTであれば複数のエンドポイ ントへのリクエストを一回のリクエストで取得できる ▪
複雑なエンドポイントやクエリパラメータを定義するこ となく、必要なフィールドのみをクライアントで取得す ることが可能
What is GraphQL? 従来のRESTモデル 5 出典:https://www.sitepoint.com/rest-2-0-graphql/
What is GraphQL? GraphQLモデル 6 出典:https://www.sitepoint.com/rest-2-0-graphql/
2 Basics of GraphQL 7
Basics of GraphQL ~server side~ TypeDefs ▪ 返すオブジェクトやインプット の型を定義 8
Basics of GraphQL ~server side~ TypeDefs ▪ Queryにデータ取得のエンドポ イントを定義 ▪
Mutationにデータ操作のエン ドポイントを定義 9
Basics of GraphQL ~server side~ Resolvers ▪ Query, Mutationのリクエス トハンドラーを実装
10
Basics of GraphQL ~client side~ Query usage ▪ 必要なフィールドを指定して queryを作成
▪ `/graphql`エンドポイントに POSTメソッドでqueryを送信 11
Basics of GraphQL ~client side~ FrameWork ▪ Client FrameWork(Apollo, Relay...)がうまいこと
loading, errorのハンドリン グやキャッシュをやってくれる 12
3 Good DX 13
Good DX ~graphiql~ ドキュメントビューとクエリを試せるGUIが組み込み済み 14
Good DX ~versioning~ ▪ バージョン管理をしないで済む ▫ 新しく型定義を追加すれば良い ▫ 破壊的変更は非推奨 ▫
削除する場合は非推奨項目であることを示すメタデータ を付与して、使われなくなったら削除 15
4 Conclusion 16
Conclusion GraphQLは ▪ かんたん! ▪ はやい! ▪ たのしい! 17
Thanks! Happy coding with GraphQL! You can find me at:
@starling888888 on Twitter 18
出典 画像出典:https://www.sitepoint.com/rest-2-0-graphql/ コード出典:https://github.com/apollographql/fullstack-tutorial 19
CREDITS Special thanks to all the people who made and
released these awesome resources for free: ▪ Presentation template by SlidesCarnival ▪ Photographs by Unsplash 20