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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Paolo Ferretti
May 02, 2017
Programming
52
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
54
Microservizi serverless estensibili, segmentabili e scalabili
pferretti
0
100
Microservizi serverless scalabili da zero a milioni di messaggi
pferretti
0
69
Multi-container applications with Docker Compose
pferretti
0
130
Multi container applications with Docker Compose
pferretti
1
420
API data stubbing done right
pferretti
0
51
Open source and free software
pferretti
0
44
Other Decks in Programming
See All in Programming
Claude Team Plan導入・ガイド
tk3fftk
0
250
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
9
6k
Build-to-own AI: Agentic Development for Humans
inesmontani
PRO
0
170
ソフトウェア設計に溶けるインフラ ― AWS CDK のインフラ認識論
konokenj
3
740
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
170
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
450
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
180
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
200
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
220
Prismを使った型安全な暗号化_関数型まつり2026
_fhhmm
0
160
Featured
See All Featured
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
500
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
600
From π to Pie charts
rasagy
0
240
エンジニアに許された特別な時間の終わり
watany
108
250k
The Curious Case for Waylosing
cassininazir
1
450
How to Ace a Technical Interview
jacobian
281
24k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Prompt Engineering for Job Search
mfonobong
0
390
Measuring & Analyzing Core Web Vitals
bluesmoon
9
950
Exploring anti-patterns in Rails
aemeredith
3
450
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
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