proxy-recorder
v0.0.7
Published
proxy with recording capabilities for easy mocking of 3rd party APIs
Downloads
38
Maintainers
Readme
proxy-recorder
proxy with recording capabilities for easy mocking of 3rd party APIs.
install
npm i proxy-recorder --save-dev
Default directory where jsons of responses are stored is relative directory test/fixtures/
##API exposes just two methods so far:
var opts = {port: 8100, target: 'https://api.github.com'};
var proxyR = require('proxy-recorder');
proxyR.rec(opts); //fires up a proxy to github which records any response going trough
//and then for testing
proxyR.mock(opts) // recorded message is retrieved from filesystem based on url and body of the message and mocked server sends the fixture back
##Other projects
connect-prism
I tried using this project for mocking github api and it was not possible, so I discarded this project as a viable solution for me. Otherwise it has the same goals and much bigger history, so it might be worth looking at. ###How does this differ from node-replay? Node replay can store mocks inside node, but doesn't help you when you need an API mock as separate node instance running side by side your single page app. Proxy recorder was made out of a need specificaly to mock Github API for E2E tests of frontend app.