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
940
Stubcellを使ってフロントやアプリの開発効率をあげよう
sussan0416
January 19, 2018
Tweet
Share
More Decks by sussan0416
See All by sussan0416
Firebaseのイベントが送信されず2週間苦しんだ話
sussan0416
0
660
レイアウトを使い回す 〜ConstraintLayout編〜
sussan0416
0
1.1k
えぇい!フリーランスだ!の前に知っておきたい、お金にまつわる2つの怖〜い話
sussan0416
0
130
Neo4jを用いたカフェ巡り行動の分析
sussan0416
0
850
Other Decks in Programming
See All in Programming
The Shape of a Service Object
inem
0
530
rails_girls_is_my_gate_to_join_the_ruby_commuinty
maimux2x
0
200
Prompt Cachingは本当に効果的なのか検証してみた.pdf
ttnyt8701
0
540
はじめてみよう量子プログラミング
itokoichi01
0
220
Ebitengineの1vs1ゲーム WebRTCの活用
ponyo877
0
380
watsonx.ai Dojo #2 生成AIを使ったアプリ開発入門編
oniak3ibm
PRO
0
240
あなたのアプリ、ログはでてますか?あるいはログをだしてますか? (Funabashi.dev用 軽量版)
uzulla
2
130
API Platform for Laravel
dunglas
1
610
How to Break into Reading Open Source
kaspth
2
220
Regular Expressions, REXML, Automata Learning
makenowjust
0
220
RAGの回答精度評価用のQAデータセットを生成AIに作らせた話
kurahara
0
260
Amazon BedrockでサーバレスなAIお料理ボットを作成する!!
tosuri13
0
230
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
5
490
Git: the NoSQL Database
bkeepers
PRO
425
64k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
278
13k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
38
9.2k
GraphQLの誤解/rethinking-graphql
sonatard
65
9.8k
Build The Right Thing And Hit Your Dates
maggiecrowley
30
2.3k
Music & Morning Musume
bryan
46
6k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
45
4.8k
The Pragmatic Product Professional
lauravandoore
31
6.2k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Statistics for Hackers
jakevdp
794
220k
A better future with KSS
kneath
235
17k
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ΛͬͨϑϩϯτΞϓϦͷࣄྫΛհ