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
960
Stubcellを使ってフロントやアプリの開発効率をあげよう
sussan0416
January 19, 2018
Tweet
Share
More Decks by sussan0416
See All by sussan0416
Firebaseのイベントが送信されず2週間苦しんだ話
sussan0416
0
690
レイアウトを使い回す 〜ConstraintLayout編〜
sussan0416
0
1.1k
えぇい!フリーランスだ!の前に知っておきたい、お金にまつわる2つの怖〜い話
sussan0416
0
130
Neo4jを用いたカフェ巡り行動の分析
sussan0416
0
870
Other Decks in Programming
See All in Programming
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
600
Jakarta EE meets AI
ivargrimstad
0
510
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
280
Amazon Bedrock Agentsを用いてアプリ開発してみた!
har1101
0
330
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.3k
Better Code Design in PHP
afilina
PRO
0
120
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.1k
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
870
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
タクシーアプリ『GO』のリアルタイムデータ分析基盤における機械学習サービスの活用
mot_techtalk
4
1.3k
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
subpath importsで始めるモック生活
10tera
0
290
Featured
See All Featured
Optimizing for Happiness
mojombo
376
70k
Fireside Chat
paigeccino
34
3k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Statistics for Hackers
jakevdp
796
220k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
1.9k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
How STYLIGHT went responsive
nonsquared
95
5.2k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Producing Creativity
orderedlist
PRO
341
39k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Bash Introduction
62gerente
608
210k
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ΛͬͨϑϩϯτΞϓϦͷࣄྫΛհ