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
REST脳脱出のためのGraphQLの命名の話
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
asmsuechan
December 19, 2018
310
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
REST脳脱出のためのGraphQLの命名の話
asmsuechan
December 19, 2018
More Decks by asmsuechan
See All by asmsuechan
入門: マークダウン
asmsuechan
0
14k
Featured
See All Featured
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
It's Worth the Effort
3n
188
29k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
520
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
440
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4k
Tell your own story through comics
letsgokoyo
1
1k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
200
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
390
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Designing Powerful Visuals for Engaging Learning
tmiket
1
460
Transcript
RESTग़ͷͨΊͷ໋໊ͷ asmsuechan
asmsuechan ࣗ ݾ հ 0 ݸਓϓϩμΫτͱ͔ͰGraphQLͬͯΔ ϑϩϯτɺαʔόʔɺͪΐͬͱΫϥυ Alibaba Cloud
MVP
GraphQLͷ໊લ͚ ࠓ ͢ ͜ ͱ “GraphQLͬΆ͍”໊લʹ ͢ΔͨΊʹࢲ͕ҙ͍ࣝͯ͠Δ͜ͱ 1
querymutationͷ໊લͷ
(1) queryͷ߹ ݁ ໊લͷཪʹόοΫΤϯυͷಈ࡞͕ݟ͑Δ 2.1 REST ໊લͷཪʹཉ͍͠σʔλ͕ݟ͑Δ GraphQL ͿͬͪΌ͚queryͷ໋໊RESTͱ͋·Γ͕ࠩͳ͍ؾ͢Δ
σʔλΛऔͬͯ͘Δͭ
(1) GET: /users/:idΛqueryʹ͢Δ ྫ ͑ getUser(id: $id) { email
name } (ਖ਼͜ΕશવڐͤΔ) ϢʔβʔΛใΛදࣔ͢ΔͨΊͷΤϯυϙΠϯτ 2.1 user(id: $id) { email name } X O ???ʮԶgetUser͍ͨ͠Μ͡Όͳͯ͘userͷใ͕ཉ͍͠ΜͩΑʯ
(2) mutationͷ߹ ݁ ໊લͷཪʹϦιʔε͕ݟ͑Δ 2.2 REST ໊લͷཪʹৼΔ͍͕ݟ͑Δ GraphQL ※Ϧιʔε:
αʔόʔͰऔΓѻΘΕΔσʔλͷҙ ※ৼΔ͍: ΫϥΠΞϯτͰϢʔβʔ͕࣮ߦ͢Δಈ࡞ͷҙ σʔλΛߋ৽͢Δͭ
ྫ ͑ (2) POST: /users/:id/followΛmutationʹ͢Δ mutation createFollowee(id: $id) {
user { id name } } mutation follow(id: $id) { user { id name } } FolloweeͬͯϦϨʔγϣϯ͕ݟ͑ͯ͠·͏ “follow”Ͱ1ͭͷৼΔ͍͕ݟ͑Δ (ϢʔβʔΛϑΥϩʔ͢ΔͨΊͷΤϯυϙΠϯτ) ײ͡Δྗ͕େࣄ 2.2 X O
ͳͥ͜Ε͕ྑ͍ͱࢥ͏ͷ͔ ཧ ༝ 3 GraphQLόοΫΤϯυͷσʔλߏΛΒͳ͍ ΫϥΠΞϯτͷ։ൃऀͨͪͷͨΊʹ࡞ΒΕ͔ͨΒ ͭ·Γྺ࢙తഎܠ
ྺ࢙తഎܠ ཧ ༝ 3 ΫϥΠΞϯτ࡞Δਓͱαʔόʔ࡞Δਓผ(ͷͣ) σΧ͍৫ͰෳࡶͳσʔλߏͷαʔϏεΛӡ༻͍ͯ͠Δதɺ σʔλߏΛΒͳ͍ਓͰָʹཉ͍͠σʔλΛऔಘ͍ͨ͠ GraphQLΛ࡞ͬͨͷFacebook
ྺ࢙తഎܠ ཧ ༝ 3 (࣮࢞ͷߘ) • ༑ୡͷߘͷதʹ༑ୡͷ༑ୡͷίϝϯτ͕ݟ͑Δ • ͍͍Ͷʹࣗͷ༑ୡ͕༏ઌදࣔ͞ΕΔ ϦϨʔγϣϯΛ͜Ͷ͘Γճ͍ͯ͠Δ
ྺ࢙తഎܠ ཧ ༝ 3 ϦιʔεAΛऔ͖ͬͯͨΒͦͷidʹج͍ͮͯ ϦιʔεBΛऔ͖ͬͯͯ…. Έ͍ͨͳ͕άνϟάνϟʹଓ͍͍ͯ͘ RESTͰΔͱԿϦΫΤετΛૹΔඞཁ͕͋Δ ͜ΕΛָʹͨͯ͘͠ੜ·Εͨͷ͕GraphQL
ݴ͍͍ͨ͜ͱ ݁ ໊લͷཪʹόοΫΤϯυ͕ݟ͑Δ 5 REST ໊લͷཪʹΫϥΠΞϯτ͕ݟ͑Δ GraphQL ※͜ΕࢲͷࢦͰ͋ͬͯղͰ͋Γ·ͤΜ
ऴ