Mimo is a HTTP/API Mocking Platform that enables you to Mock APIs. Emulations can be simple responses with a JSON body and headers, or they can be dynamically changed using JavaScript functions.
The purpose of creating Mimo was to enable a single user or a group of users to emulate their own APIs or HTTP requests. This could be for testing positive and negative scenarios, mocking an external API locally or as testing environment for other developers to use while the full API is being developed.
The name Mimo was choosen for it's Italian translation meaning Mocking Bird.
Once a user creates a login all of their APIs will be available at {host}/{username}/{appName}/{resource}. Each user can have multiple applications and each application can have multiple endpoints/resources.
Using JavaScript helper functions request
and response
the incoming request data can be accessed and the response can be modified. For example if the request is a POST and the API being mocked should not accept POST calls the following dynamic API response can be used:
if (request.getMethod() == "post") {
var body = {'error': 'POST Method not supported'};
response.setBody(body);
} else {
var body = {'success': 'true'};
response.setBody(body);
}
Other request
and response
functions available:
request.getHeader()
request.getPath()
request.getQueryParam()
request.getBody()
request.getParsedBody()
- supports XML and JSON Parsingresponse.setHeader()
responsesetBody()
responsesetStatusCode()
responsesetPause()
responsesetRedirect()
A full list of available functions can be found here.
- Clone git repo
- cd into mimo folder
- Type:
npm install
- Start node:
npm start
ornode app.js
- Open: http://localhost:3000 in your browser
- Either sign up at http://localhost:3000 or login as demo:passw0rd
- Docs can be viewed at http://localhost:3000/docs
Note: you must have node.js binaries installed and in your PATH to work
When not running Mimo locally and wanting to run more threads use the following method. Mimo will create 1 thread per core automatically and launch on port 8000.
- Start node:
export NODE_ENV=production; node app.js
- Open: http://localhost:8000 in your browser
All Mimo data is stored in a SQLite Database allowing the package to be portable, sharable and only require Node.js to be installed on the host system.
Mimo was created as part of Shutterfly's Hack Day 2013 and a collaboration between Brad Vernon, Sarah Pugliaresi and Vasu Jain.
Mimo is built using Express.js, Angular.js and Bootstrap.
Please use the GitHub Issues to report any problems.
If you are looking for a Express v3.x and node 0.10 compatible version please visit: https://github.com/ibspoof/Mimo/tree/Express3Compatible