Skip to content

differui/node-rnr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Record & Replay HTTP streams by node.js

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published