log-socket
tcp proxy socket that dumps everything through it to console.log - useful for debugging HTTP servers
install
$ npm install log-socket
usage
var http = var logsocket = var server = http // redirect everything to this backend socketvar proxy = // Request dataproxy // Response dataproxy serverproxy
If you then curl to the logsocket - you will get a response from the backend HTTP server and the logsocket will dump all the traffic going through it
$ curl -L http://127.0.0.1:8080
api
var proxy = logsocket(port, [address, opts])
Return a tcp socket that will proxy traffic back to address:port - the default for address is '127.0.0.1'
Opts are passed into new net.Socket(opts)
events
proxy.on('input', function(chunk, enc){})
Called when data is recieved by the socket
proxy.on('output', function(chunk, enc){})
Called when data is sent by the socket
license
MIT