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
Rails 5 で作る RESTful API 速習会 / Rails RESTful API
Search
Altech
April 19, 2017
Programming
5
1.1k
Rails 5 で作る RESTful API 速習会 / Rails RESTful API
https://wantedly.connpass.com/event/55138/
https://github.com/Altech/rails-restful-api/pulls
Altech
April 19, 2017
Tweet
Share
More Decks by Altech
See All by Altech
継続的なサービス発展を支えるアーキテクチャと技術 / Developers Summit 2023
altech
20
5.9k
Wantedly の技術とアーキテクチャ / 2023年度 新人研修
altech
2
600
技術を的に当てる技術について - GraphQL を入れ直した話 / 吉祥寺.pm28
altech
7
5.8k
マイクロサービス・アーキテクチャと共存する Ruby on Rails のアーキテクチャ的拡張 - その事例と可能性 / Kaigi on Rails 2021
altech
8
3.2k
ソフトウェア設計の Why & What & How / Wantedly 新卒研修
altech
0
11k
Data-Driven Service-Oriented Architecture & UI
altech
3
1.5k
Ruby で作るデータ分析基盤
altech
9
1.9k
Object-Oriented Abstraction of Redis Sorted Set
altech
2
2.4k
Microservices on “Rails” - Wantedly のマイクロサービス事例
altech
8
5.6k
Other Decks in Programming
See All in Programming
Click-free releases & the making of a CLI app
oheyadam
2
120
watsonx.ai Dojo #4 生成AIを使ったアプリ開発、応用編
oniak3ibm
PRO
1
140
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
Why Jakarta EE Matters to Spring - and Vice Versa
ivargrimstad
0
1.1k
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
190
TypeScriptでライブラリとの依存を限定的にする方法
tutinoko
3
690
Tauriでネイティブアプリを作りたい
tsucchinoko
0
370
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
CSC509 Lecture 09
javiergs
PRO
0
140
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Jakarta EE meets AI
ivargrimstad
0
650
flutterkaigi_2024.pdf
kyoheig3
0
140
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
Designing for humans not robots
tammielis
250
25k
RailsConf 2023
tenderlove
29
900
Imperfection Machines: The Place of Print at Facebook
scottboms
265
13k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
Documentation Writing (for coders)
carmenintech
65
4.4k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
A Philosophy of Restraint
colly
203
16k
Building Adaptive Systems
keathley
38
2.3k
Optimizing for Happiness
mojombo
376
70k
Transcript
ฏʗSOHEI TAKENO Rails 5 Ͱ࡞Δ RESTful API शձ api/v2
शձ 2017/04
γΰτͰίίϩΦυϧ • ࣗݾհ • ಋೖഎܠ • ϓϩτίϧ • ج൫࣮ •
࣮ફʢ45minʣ ϝχϡʔ
γΰτͰίίϩΦυϧ ࣗݾհ
γΰτͰίίϩΦυϧ • Sohei Takeno / @Altech_2015 • 20164݄ʹ Wantedly ʹΤϯδχΞͱͯ͠ೖࣾ
• Wantedy Visit ʹؔΘ͍ͬͯΔ • άϩʔε ― Push௨ϝʔϧͷσβΠϯվળɾνϡʔχϯάɺͦͷଞ UI ςετ • αʔϏε։ൃج൫ͷඋ ― BigQuery ಋೖ, σʔλղੳδϣϒγεςϜɺPush௨ج൫ • Ϛονϯάվળ ― ืूΛ୳͢ػೳʢϑΟϧλɾݕࡧʣͷϩδοΫˍUIվળ • ωΠςΟϒΞϓϦ͚ͷ API ࡞ ࣗݾհ
γΰτͰίίϩΦυϧ ৽͍͠APIͷಋೖഎܠ
γΰτͰίίϩΦυϧ • api/v1 ͱ͍͏ API namespace ͕ݩʑ͋ͬͨ • ը໘ͱAPI͕ີ݁߹͍ͯͨ͠ʢ؇͍ 1screen
- 1 request ํࣜʣ • දࣔΛॏࢹ • ɿ • νʔϜߏͷมԽʹґΔɺը໘ͱີ݁߹ʹىҼ͢Δੜ࢈ੑԼ • ϓϩτίϧ͕ͳ͍ʢϨεϙϯεͷܗࣜΛͲ͏͢Δ͔Λຖճ֬ೝʣ ಈػ
γΰτͰίίϩΦυϧ • RESTful ͳ API ʹΞʔΩςΫνϟΛมߋ • ϓϩτίϧͷنఆ • →
api/v2 ͱͯ͠࡞ • ʢɿ௨ৗͷόʔδϣχϯάతͳ͍ํͱҟͳΔʣ ղܾํ๏
γΰτͰίίϩΦυϧ • νʔϜͷϓϥοτϑΥʔϜ͝ͱͷ୲ํ๏ • Web ͱΞϓϦͷϓϩάϥϚҰக͢Δͷ͔ɺ͠ͳ͍ͷ͔ • νʔϜͷαʔϏε։ൃͷମ੍ • ผʑʹػೳΛ࣮͍ͯ͘͠ͷ͔ɺ౷Ұͯ͠ਐΊ͍ͯ͘ͷ͔ɺWeb
͕ઌߦ͢Δͷ͔ɺΞϓϦ͕ઌߦ͢Δͷ͔ • ϢʔβʔʢiOS, Android ϓϩάϥϚʣͷϦςϥγʔ • ΫϥΠΞϯτʢiOS ΞϓϦ, Android ΞϓϦʣͷઃܭ • ΞʔΩςΫνϟʁViewModel Έ͍ͨͳͷΛೖΕΔ͜ͱՄೳ͔ʁ • ͳͲ… લఏɿRESTful ͔ͩΒྑ͍Θ͚Ͱͳ͍ API ͷΞʔΩςΫνϟΛܾఆ͢Δࡍʹґଘͨ͜͠ͱͷྫɿ
γΰτͰίίϩΦυϧ v1 ࡞࣌
γΰτͰίίϩΦυϧ • Wantedly Visit ॳͷ iOS ΞϓϦϦϦʔε • ಉ͡ҰਓͷϓϩάϥϚ͕ iOS
Web ॻ͘ • Server-Client = 1 : 1 v1࡞࣌ͷ։ൃମ੍ʢ2014/5ʣ
γΰτͰίίϩΦυϧ • Web, iOS, Android ͦΕͧΕҰਓʢUser Growth νʔϜʣ • Web
Web Ͱ iterative ʹϦϦʔεɾݕূͯ͠αʔϏε վળΛ͍ͯ͘͠ͷ͕ϝΠϯλεΫ • Web ͕ઌߦ͢Δ։ൃͳͷͰ API Λॻ࣌͘Ϟσϧ͋Δఔ Ͱ͖͍ͯΔঢ়ଶ • ʢͪͳΈʹݱࡏ Web, iOS ͱʹೋਓʹʣ v2࡞࣌ͷ։ൃମ੍ʢ2017/1ʣ
γΰτͰίίϩΦυϧ • ը໘ͷৄࡉʹ͍͍ͪͪ Web ͷΤϯδχΞ͕͍ؔͯͯ͠ੜ࢈ੑ͕Լ͕Δ • มߋͷࡍɺطʹ͋Δը໘ͷ͕ࣝલఏʹͳΔͷͰɺ͍͠ • ίϛϡχέʔγϣϯͷ༰͕σʔλʹϑΥʔΧε͞ΕΔ •
ϞσϧʹରԠͯ͠ΤϯυϙΠϯτͱίϯτϩʔϥΛ࡞͍ͬͯ͘ͷͰɺมߋ ͖͢Օॴ͕໌֬ • ઃܭʹ੍͕ՃΘΔͷͰɺΑΓͦ͜ʹϑΥʔΧε͍͍ͨ͢͠ϓϩτί ϧϥΠϒϥϦΛಋೖͰ͖ΔΑ͏ʹͳΔ ಋೖഎܠ·ͱΊ api/v2 ͷಋೖ
γΰτͰίίϩΦυϧ ϓϩτίϧ
https://github.com/Altech/rails-restful-api/blob/master/README.md
γΰτͰίίϩΦυϧ ج൘࣮
γΰτͰίίϩΦυϧ • ActiveModelSerializers ΛϦΫΤετύϥϝʔλͱͭͳ͙ • N+1 ΛγεςϚςΟοΫʹ͙Έ • ad-hoc ύϥϝʔλΛϢʔβʔʹ͑Δํ๏
• ίʔυɿPull Requests · Altech/rails-restful-api ඞཁͩͬͨج൫࣮
γΰτͰίίϩΦυϧ ࣮ફ
γΰτͰίίϩΦυϧ • Wantedly Visit ͷձࣾը໘ͷAPIΛ࡞Δ • Ұॹʹॻ͍͍͖ͯ·͢ʂ श༰
None
γΰτͰίίϩΦυϧ • ɿhttps://github.com/Altech/rails-restful-api/pull/7
γΰτͰίίϩΦυϧ ͋Γ͕ͱ͏͍͟͝·ͨ͠ɻ