1.5.6 • Published 7 years ago
mim-json-proxy v1.5.6
MIM JSON proxy
A tool which can be used as ‘man in the middle’ proxy. It can be used to sit between two JSON webservices endpoints (e.g. Facebook/Twitter and your application) to intercept the webservices traffic between them and modify it.
Features
- Possibility to mock entire response and/or request
- Possibility to mock only part of response and/or request
- Possibility to mock response status code
- Simulate delays on service calls
- Easy way to change endpoints on the fly (i.e. developer / staging)
- JSON based configuration with JS defined rules for flexibility
- JSON based configuration is backed up by JSON schema
Getting started (API)
- Install the proxy
npm i mim-json-proxy - In the code
const JsonProxy = require('mim-json-proxy'); const proxy = new JsonProxy(options); proxy.start();
Getting started (command line)
- Install the proxy
npm install -g mim-json-proxy - Usage:
mim-json-proxy {OPTIONS}
Examples
Examples can be found in the examples directory.
Options
Options are for API usage and the command line:
port: port to open the server on (default3005)configsDirectory: defines proxy configurations directory (default./configs)defaultConfigName: defines default configuration name (defaultproxy-config.json)configUI.enabled: whether to enable the UI for easier proxy config adjustments (defaulttrue)configUI.endpoint: path for the config UI (default/config)bodyParserLimit: limit for express bodyParser (default5mb)cors: cors configuration to pass to express (default{credentials: true})https: whether to start server using https or not (defaultfalse)certificates.key: HTTPS certificate key path (default./certificates/server.key)certificates.cert: HTTPS certificate CRT path (default./certificates/server.crt)
API
start(options): starts the server with providedoptionsaddController(path, controller): possibility to define custom controller on the server (i.e. replacing/config)addDynamicRule(endpointName, func): add dynamic rule, thefunctakes following as argument:{ requestBody, responseStatusCode, responseBody, isResponse, isRequest, reqURL, reqMethod }
Developer notes
- You can use
npm startto run the proxy locally - Proxy runs on port 3005 by default to relay the communication to webservice. The
/configendpoint can be used to adjust the configuration in simple UI configs/proxy-config.jsondefines rules and endpointsproxy-config.schema.jsondefines how the above file should look like
1.5.6
7 years ago
1.5.5
7 years ago
1.5.4
7 years ago
1.5.3
7 years ago
1.5.2
7 years ago
1.5.1
7 years ago
1.5.0
7 years ago
1.4.11
7 years ago
1.4.10
7 years ago
1.4.9
7 years ago
1.4.8
7 years ago
1.4.7
7 years ago
1.4.6
7 years ago
1.4.5
7 years ago
1.4.4
7 years ago
1.4.3
7 years ago
1.4.2
7 years ago
1.4.1
7 years ago
1.4.0
7 years ago
0.3.2
7 years ago
0.3.1
7 years ago
0.3.0
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.0
7 years ago