A simple proxy server that enable you to mock specific api methods whereas other methods still requested from real API
aproxy start https://example.com/api \
--mockFile ./mock.json \
--mockScript ./mockScript.js \
--mode=error (optional, defaults to success)
to mock https://example.com/api/keyA/keyB use mock file:
{
"keyA": {
"keyB": {
"test": "data"
}
}
}
Also you can choose mode of HTTP response: success or error. If you choose error
mode HTTP response status code will be 202
module.exports = (url, params, mock) => {
params; // POST parameters
mock; // subset of mock.json related to url
return mock;
};