Skip to content

linghuaj/node-proxy-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Proxy Server

This is a Proxy Server for Node.js submitted as the pre-work requirement for CodePath.

Time spent: [1hr]

##Completed:

  • [done] Required: Requests to port 8000 are echoed back with the same HTTP headers and body
  • [done] Required: Requests/reponses are proxied to/from the destination server
  • [done] Required: The destination server is configurable via the --host, --port or --url arguments
  • [done] Required: The destination server is configurable via the x-destination-url header
  • [done] Required: Client requests and respones are printed to stdout
  • [done] Required: The --logfile argument outputs all logs to the file specified instead of stdout
  • [done] Optional: The --exec argument proxies stdin/stdout to/from the destination program
  • [done] Optional: The --loglevel argument sets the logging chattiness
  • [todo] Optional: Supports HTTPS
  • [todo] Optional: -h argument prints CLI API

For help. run

babel-node index.js  -h

##Recording of achievements as gif:

solarized dualmode

##to reproduce the gif, plz try any of the following:

//do a npm install first

npm start
curl -v http://127.0.0.1:8001 -H 'x-cat:niuniu'


nodemon -x babel-node index --url http://google.com
curl -v http://127.0.0.1:8001 -H 'x-cat:niuniu'


nodemon -x babel-node index --host google.com --port 80
curl -v http://127.0.0.1:8001 -H 'x-cat:niuniu'


babel-node index
curl -v http://127.0.0.1:8001 -H 'x-cat:niuniu'
curl -v http://127.0.0.1:8001 -H 'x-destination-url:http://google.com'


babel-node index --mylog=/tmp/codepath-proxy.log

curl -v http://127.0.0.1:8001 -H 'x-destination-url:http://google.com'

##child process:

solarized dualmode

##log level: solarized dualmode

About

[CodePath] Proxy server created for node camp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published