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
MilanoJS - API data stubbing done right
Search
Paolo Ferretti
May 02, 2017
Programming
47
0
Share
MilanoJS - API data stubbing done right
Flash talk for MilanoJS to explain what is Saray and how to mock API data using it.
Paolo Ferretti
May 02, 2017
More Decks by Paolo Ferretti
See All by Paolo Ferretti
Serverless VS SAM
pferretti
0
49
Microservizi serverless estensibili, segmentabili e scalabili
pferretti
0
91
Microservizi serverless scalabili da zero a milioni di messaggi
pferretti
0
49
Multi-container applications with Docker Compose
pferretti
0
120
Multi container applications with Docker Compose
pferretti
1
400
API data stubbing done right
pferretti
0
46
Open source and free software
pferretti
0
42
Other Decks in Programming
See All in Programming
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
190
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
130
Don't Prompt Harder, Structure Better
kitasuke
0
320
Smarter Angular mit Transformers.js & Prompt API
christianliebel
PRO
1
120
実践ハーネスエンジニアリング #MOSHTech
kajitack
7
5.9k
ローカルで稼働するAI エージェントを超えて / beyond-local-ai-agents
gawa
2
250
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
970
野球解説AI Agentを開発してみた - 2026/02/27 LayerX社内LT会資料
shinyorke
PRO
0
400
メッセージングを利用して時間的結合を分離しよう #phperkaigi
kajitack
3
560
Spec Driven Development: The End Of Vibe Coding | DevLand 2026
danielsogl
PRO
0
110
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
240
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
230
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
450
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
110
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
170
What does AI have to do with Human Rights?
axbom
PRO
1
2.1k
How to build a perfect <img>
jonoalderson
1
5.3k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
160
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
2
1k
Visualization
eitanlees
150
17k
Designing Experiences People Love
moore
143
24k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
330
What Being in a Rock Band Can Teach Us About Real World SEO
427marketing
0
210
Transcript
API data stubbing done right With Saray and Node.js
What is a data stubber? It’s a software that permits
to mock data
Why it is important to stub data? • for software
development • consistent data for functional tests • safe environments for product demo
We can stub data with Saray! 'Yet Another Rest API
Stubber'.split(' ').reverse().map(item => item[0].toLowerCase()).join('')
Saray can transform this… /home/paolo/saray/simple.GET.json { “message”: “Hi Milan, I’m
a stubbed API call” } …into this GET http://locahost:8000/simple HTTP/1.1 200 OK X-Powered-By: Express Access-Control-Allow-Origin: * Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, PATCH, DELETE Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization Access-Control-Allow-Credentials: true Saray-Stubbed: true Content-Type: application/json; charset=utf-8 Content-Length: 46 ETag: W/"2e-89E9C8HHkWvwlUiWgeXBGIuHeyw" Date: Sun, 30 Apr 2017 18:14:33 GMT Connection: keep-alive { “message": "Hi Milan, I'm a stubbed API call" }
You can also use JS! module.exports = function(req, res, log,
next) { res.json({key: 'value'}); };
Saray as a proxy GET http://locahost:8000/simple $ saray —path data
—endpoint https://myapi.com https://myapi.com Saray
Saray with dynamic paths GET http://localhost:8081/simple/salutation/hello $ saray —path data
—dynpath=‘_’ simple/_/hello.GET.json GET http://localhost:8081/simple/greeting/hello GET http://localhost:8081/simple/curtsy/hello
Thank you! Saray: https://github.com/contactlab/saray Saray demo: https://github.com/contactlab/saray-demo