I'm on a nice project where I need to develop a kind of proxy in NodeJS. When you work to forward data after possible filtering or transformation, it's never too easy to quickly set up an environment in order to test your on-going development.

Using NodeJS, I extended my colleague very small HTTP server that just returns a 201 HTTP code and prints the request body in the console:

// debug-server.js
var http = require('http');
var port = process.env.PORT || 8080;
var host = '';

http.createServer(function (request, response) {
    // console.log(request.headers);
    request.on('end', function () {
}).listen(port, host, 511, function () {
    console.log('Started to listen on ' + host + ':' + port);

That's it. No need for no dependency, just have NodeJS installed and run it:

$ node debug-server.js
Started to listen on

If you need to specify another port:

$ PORT=6677 node debug-server.js
Started to listen on

Have fun, happy coding :)

Joris Berthelot