The configurable mixing proxy for your web development needs
mix-n-mock is a selective proxy server that mixes local mock files from your file system with real HTTP responses from a remote server.
Imagine Alice develops a web frontend (HTML, JS) while Bob provides the corresponding backend with HTTP services.
As the project emerges, Alice and Bob agree on an API and both start working. Since Alice needs some sort of test data as soon as possible, she decides to throw some static dummy files to her local filesystem and set up a local web server that serves these static files. She can now develop the frontend without having to wait for Bob’s implementation.
This is great, but at some point Bob will finish his work, so Alice should use the real service on Bob’s staging server. As the project evolves, more and more real services are available, and Alice can use them.
This is where mix-n-mock comes in handy: Alice can simply update her config file to toggle between real data and static dummy files on a per-service level.
mix-n-mock offers several advantages compared to a ProxyPass rule:
- Changes to config files are detected automatically, and the server restarts instantly
- proxied services can be delayed, i.e. you can artificially throttle individual real web services
- Static file delivery can also be delayed
- Each HTTP method (GET, POST, PUT, DELETE) can be configured independently
- HTTP status codes can easily be generated per service, i.e. it is easy to simulate errors
- clone this repository
- get Node.js (Version 4 or higher)
- run
npm install
in the project folder
See usage.
To see an example, simply run
npm start example
and open
http://localhost:8080/
in your favorite browser.