https://github.com/capaj/proxy-recorder
proxy with recording capabilities for easy mocking of 3rd party APIs
https://github.com/capaj/proxy-recorder
javascript proxy proxy-recorder
Last synced: about 1 year ago
JSON representation
proxy with recording capabilities for easy mocking of 3rd party APIs
- Host: GitHub
- URL: https://github.com/capaj/proxy-recorder
- Owner: capaj
- License: mit
- Created: 2015-02-16T16:28:24.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-02-25T20:20:28.000Z (over 9 years ago)
- Last Synced: 2025-03-28T17:01:45.802Z (over 1 year ago)
- Topics: javascript, proxy, proxy-recorder
- Language: JavaScript
- Size: 21.5 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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:
```javascript
const proxyR = require('proxy-recorder')
const opts = {port: 8100, target: 'https://api.github.com'}
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](https://github.com/seglo/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](https://github.com/assaf/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.