node-rnr

0.6.12 • Public • Published

node-rnr

Record & Replay HTTP streams by node.js

Software License Issues JavaScript Style Guide NPM

Overview

rnr creates a proxy server between user client and remote server.It records responses from remote server in file system and replays them when user client request again.

 
        request   __________  request   ________
user       →     | has      |    →     | remote |
client     ←     | records? |    ←     | server |
        response |__________| response |________|
                      ↑ ↓
                  file system

Usage

Install it:

npm install node-rnr -g

Commands

rnr --target [remote server host]

Proxy:

# dumb proxy 
rnr --target http://localhost:8888

Record & Replay:

# record client requests 
rnr --record --target http://localhost:8888
 
# replay request with records 
rnr --replay --target http://localhost:8888

See a list of all available options:

rnr --help

Config File

You can use config file instead of command line options:

// rnr.config.js
module.exports = {
  record: true,
  replay: false,
  port: 5000,
  proxy: {
    target: 'http://localhost:8888',
    changeOrigin: true,
  },
  verbose: true,
}

Run this command to use the config file:

rnr -c # default config file rnr.config.js 
rnr -c my.rnr.config.js # customize config file 

More

License

MIT © BinRui.Guan

Readme

Keywords

Package Sidebar

Install

npm i node-rnr

Weekly Downloads

2

Version

0.6.12

License

MIT

Last publish

Collaborators

  • differui