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
1.1k
Stubcellを使ってフロントやアプリの開発効率をあげよう
sussan0416
January 19, 2018
Tweet
Share
More Decks by sussan0416
See All by sussan0416
Firebaseのイベントが送信されず2週間苦しんだ話
sussan0416
0
790
レイアウトを使い回す 〜ConstraintLayout編〜
sussan0416
0
1.3k
えぇい!フリーランスだ!の前に知っておきたい、お金にまつわる2つの怖〜い話
sussan0416
0
180
Neo4jを用いたカフェ巡り行動の分析
sussan0416
0
990
Other Decks in Programming
See All in Programming
ライブ配信サービスの インフラのジレンマ -マルチクラウドに至ったワケ-
mirrativ
2
270
Dart 参戦!!静的型付き言語界の隠れた実力者
kno3a87
0
210
TROCCO×dbtで実現する人にもAIにもやさしいデータ基盤
nealle
0
330
あなたとJIT, 今すぐアセンブ ル
sisshiki1969
1
730
Rancher と Terraform
fufuhu
0
110
Google I/O recap web編 大分Web祭り2025
kponda
0
2.9k
私の後悔をAWS DMSで解決した話
hiramax
4
140
Namespace and Its Future
tagomoris
5
370
マイコンでもRustのtestがしたい その2/KernelVM Tokyo 18
tnishinaga
2
2.3k
250830 IaCの選定~AWS SAMのLambdaをECSに乗り換えたときの備忘録~
east_takumi
0
180
Claude Codeで実装以外の開発フロー、どこまで自動化できるか?失敗と成功
ndadayo
2
1.4k
コーディングエージェント時代のNeovim
key60228
1
100
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
223
9.9k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
50
5.5k
Building an army of robots
kneath
306
46k
Balancing Empowerment & Direction
lara
2
590
It's Worth the Effort
3n
187
28k
Automating Front-end Workflow
addyosmani
1370
200k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
A Tale of Four Properties
chriscoyier
160
23k
Art, The Web, and Tiny UX
lynnandtonic
302
21k
Making Projects Easy
brettharned
117
6.3k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
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ΛͬͨϑϩϯτΞϓϦͷࣄྫΛհ