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
0
44
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
Tweet
Share
More Decks by Paolo Ferretti
See All by Paolo Ferretti
Serverless VS SAM
pferretti
0
49
Microservizi serverless estensibili, segmentabili e scalabili
pferretti
0
83
Microservizi serverless scalabili da zero a milioni di messaggi
pferretti
0
36
Multi-container applications with Docker Compose
pferretti
0
120
Multi container applications with Docker Compose
pferretti
1
390
API data stubbing done right
pferretti
0
42
Open source and free software
pferretti
0
39
Other Decks in Programming
See All in Programming
Graviton と Nitro と私
maroon1st
0
160
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
440
PostgreSQLで手軽にDuckDBを使う!DuckDB&pg_duckdb入門/osc25hi-duckdb
takahashiikki
0
240
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
170
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
160
Vibe codingでおすすめの言語と開発手法
uyuki234
0
160
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
470
SQL Server 2025 LT
odashinsuke
0
130
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
370
Basic Architectures
denyspoltorak
0
180
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
350
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
300
Featured
See All Featured
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
0
52
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.8k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
130
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.3k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
62
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
79
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
110
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
49
GitHub's CSS Performance
jonrohan
1032
470k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
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