Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
REST脳脱出のためのGraphQLの命名の話
Search
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
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
310
Practical Orchestrator
shlominoach
191
12k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Limits of Empathy - UXLibs8
cassininazir
1
640
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
Un-Boring Meetings
codingconduct
0
410
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
560
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
600
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Spectacular Lies of Maps
axbom
PRO
1
980
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 ※͜ΕࢲͷࢦͰ͋ͬͯղͰ͋Γ·ͤΜ
ऴ