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
Stubcellを使ってフロントやアプリの開発効率をあげよう
Search
sussan0416
January 19, 2018
Programming
0
970
Stubcellを使ってフロントやアプリの開発効率をあげよう
sussan0416
January 19, 2018
Tweet
Share
More Decks by sussan0416
See All by sussan0416
Firebaseのイベントが送信されず2週間苦しんだ話
sussan0416
0
700
レイアウトを使い回す 〜ConstraintLayout編〜
sussan0416
0
1.2k
えぇい!フリーランスだ!の前に知っておきたい、お金にまつわる2つの怖〜い話
sussan0416
0
140
Neo4jを用いたカフェ巡り行動の分析
sussan0416
0
890
Other Decks in Programming
See All in Programming
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
160
Асинхронность неизбежна: как мы проектировали сервис уведомлений
lamodatech
0
620
Zoneless Testing
rainerhahnekamp
0
120
return文におけるstd::moveについて
onihusube
1
650
Security_for_introducing_eBPF
kentatada
0
110
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
160
快速入門可觀測性
blueswen
0
310
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
3
920
ソフトウェアの振る舞いに着目し 複雑な要件の開発に立ち向かう
rickyban
0
890
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
200
useSyncExternalStoreを使いまくる
ssssota
6
1k
Featured
See All Featured
Statistics for Hackers
jakevdp
796
220k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
45
2.2k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Building Better People: How to give real-time feedback that sticks.
wjessup
365
19k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
247
1.3M
We Have a Design System, Now What?
morganepeng
51
7.3k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.5k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
Code Reviewing Like a Champion
maltzj
520
39k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
How GitHub (no longer) Works
holman
311
140k
Transcript
StubcellΛͬͯ ϑϩϯτΞϓϦͷ ։ൃޮΛ͋͛Α͏ @sussan_0416 2017/01/19ɹएखΤϯδχΞLT #3
ླʢ@sussan_0416ʣ • 2015৽ଔೖࣾʢ3 ·ͩएखʣ • Android/iOSΞϓϦΤϯδχΞ ʢJava, Kotlin, Swiftʣ •
ݱࡏɺࠂ৴Λ࠷దԽ͢Δػց ֶशΛ୲ ʢpython, Dataflow, PHP etc..ʣ
֓ཁ 1. ϑϩϯτଆ։ൃ͋Δ͋Δͷ 2. Stubcellͷಋೖํ๏ͱ͍ํ 3. StubcellΛࣾͰͬͨࣄྫ
ϑϩϯτΞϓϦͷ։ൃͰ
Α͋͘Δʮʯ
1. APIΑΓϑϩϯτͷ։ൃ͕ ઌߦͪ͠Όͬͨ
2. σόοά͍͚ͨ͠Ͳ API͔Βҙਤͨ͠Ϩεϙϯε͕ ฦͬͯ͜ͳ͍
3. ֎෦ͷAPIΛ͍ͬͯͯɺ SandboxϞʔυ͕ແ͍
։ൃͰΑ͋͘ΔϞϠϞϠ • APIΑΓϑϩϯτ͕։ൃઌߦͨ͠ ˠ ͤΊͯURI͚ͩͰ༻ҙ͠ͱ͍ͯ΄͍͠ʂ • API͔Βҙਤͨ͠Ϩεϙϯε͕ฦͬͯ͜ͳ͍ ˠ ϥϯμϜੑͷ͋ΔͷͳͲݕূ͕ࠔʂ •
SandboxϞʔυ͕ແ͍ ˠ ֎෦ͩͬͨΒͳ͓͞Β͍͠
APIΛϞοΫͨ͠Βղܾʂ
Stubcell ͬͯͷ͕͋ΔΒ͍͠ Stubcell https://github.com/yosuke-furukawa/stubcell
Stubcell • JSONΛฦ͢͜ͱʹಛԽͨ͠stubαʔόʔ • Ϩεϙϯε༰Λఆٛ͢ΔϑΝΠϧʹɺίϝ ϯτΛॻ͖ࠐΊΔʢJSON5ରԠʣ Stubcell ϞοΫ͍ͯ͠ͳ͍URIɺຊདྷͷAPIʹϦΫΤετ͢Δ ϞοΫͨ͠URIɺStubcell͔ΒϨεϙϯε
ಋೖํ๏
npmͰΠϯετʔϧ $ npm -g install stubcell npm WARN deprecated
[email protected]
:
Use uuid module instead /usr/local/bin/stubcell -> /usr/local/lib/node_modules/stubcell/bin/ stubcell.js +
[email protected]
added 110 packages in 14.713s
͍ํ3εςοϓ! • entry.yamlΛॻ͘ʢStubαʔόͷઃఆʣ • ֤URIͷϨεϙϯεΛςΩετϑΝΠϧʹॻ͘ • ίϚϯυϥΠϯ͔Βىಈ͢Δ
͔ΜͨΜ!
entry.yamlʢجຊྫʣ # جຊ - request: url: /hoge method: get response:
status: 200 file: hoge.json # ϨεϙϯεΛॻ͍ͨྫ - request: url: /fuga method: get response: status: 200 body: '{"text": ";͕ͩͶ"}' ←/hogeͷϦΫΤετʹ ɹhoge.jsonͷ༰Λฦ͢ ʢී௨ͷςΩετͰOKʣ ←bodyύϥϝʔλʹ ɹॻ͍ͨྫ
͋ͱىಈ͢Δ͚ͩ $ stubcell Listening on 8090 entry yaml is /Users/ta_suzuki/Documents/stubcell/entry.yaml
silent is false record proxy is undefined loose compare undefined $ stubcell --port 3000ɹɹˡ ϙʔτͷࢦఆ $ stubcell --entry ./entry.yamlɹɹˡ entryϑΝΠϧͷࢦఆ $ stubcell --record_target http://echo.jsontest.comɹɹˡ αʔόͷࢦఆ
͔ΜͨΜ!! γϯϓϧ!!
ࣾͰͬͨࣄྫ
εϚϗΞϓϦ։ൃ Stubcell PC γϛϡϨʔλ ։ൃAPI ։ൃதͷURIΛϞοΫ ։ൃࡁΈͷURI௨ա ։ൃதͷURIΛϞοΫͯ͠ɺ։ൃޮΛ্͛Δྫ APIଆͷ։ൃͷਐḿʹӨڹ͞Εͣɺϑϩϯτଆͷ։ൃΛਐΊΒΕΔΑ͏ʹͳͬͨ!!
֎෦APIར༻ͷϑϩϯτ։ൃ ։ൃAPI ֎෦API Stubcell PC ֎෦ͷAPIΛ༻͍ͯ͠ΔՕॴΛϞοΫͯ͠ɺ։ൃޮΛ্͛Δྫ ِͨ͠JSONΛฦ͢ ଓ͠ͳ͍ ֎෦APIͷϨεϙϯεΛِͰ͖Δ͔Βɺσόοά͘͢͠ͳͬͨ!!
ಋೖͯ͠Α͔ͬͨ͜ͱ • APIଆͷ։ൃͷਐḿʹ͔͔ΘΒͣҰ௨Γͷಈ࡞ ֬ೝ͕Ͱ͖Δ • ҙਤͨ͠ϨεϙϯεΛฦͤΔ͔Βσόοά͠ ͍͢ • entry.yamlϨεϙϯεͷ༰༷ॻʹͳΔ ͠ɺςΩετఆ͔ٛͩΒgitཧ͍͢͠
·ͱΊ • ։ൃதʹΑ͋͘Δʮʯ APIͷ։ൃঢ়گɺ֎෦ͷAPIͷڍಈʹӨڹ͞Εͣʹ։ൃ͍ͨ͠ͱ͖ͬͯ͋ΔΑͶ • StubcellΛ͏ͱɺAPIΛϞοΫͰ͖ͯศར npm -g install stubcell
entry.yamlΛॻ͘ɺϨεϙϯεΛϑΝΠϧʹॻ͘ɺstubcellͰىಈ͢Δ • StubcellΛࣾͰͬͨࣄྫ εϚϗΞϓϦ։ൃͱ֎෦APIΛͬͨϑϩϯτΞϓϦͷࣄྫΛհ