A simple proxy server in node with logging and cli
NodeJS
if not already installed. See http://nodejs.org/babel-node
: npm install -g babel
nodemon
: npm install -g nodemon
git clone git@github.com:niki4810/node-proxy.git
npm install
From the root directory of your project
1) Using babel
$ babel-node index.js
2) using nodemon
$ nodemon --exec babel-node -- index.js
3) using npm start
$ npm start
npm start
curl http://127.0.0.1:8000 -d "Hello Echo"
-v
-H
npm start
curl -v http://127.0.0.1:8001 -d "Hello From Proxy" -H "x:asdf:Temp Proxy Header"
npm start
curl -v http://127.0.0.1:8001 -H "x-destination-url:http://www.google.com"
start the server using (pass url arg) nodemon --exec babel-node -- index.js --url http://www.google.com
from another terminal tab run curl -v http://127.0.0.1:8001
you can also open a browser and navigate to http://127.0.0.1:8001`, it should redirect you to google.com
process.stdout
nodemon --exec babel-node -- index.js --stream /tmp/node-proxy.log
curl http://127.0.0.1:8000 -d "Hello Echo"
cat /tmp/node-proxy.log
1) Utilized chalk
(https://www.npmjs.com/package/chalk) to add colors to log statements
2) Adding documentation flags
Temperoraly code checked into this branch chore-adding-documentation-to-args