Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A little node server that just gives your request back to you as JSON.
var http = require('http')
, sys = require('sys')
, server
;
server = http.createServer(function(req, res) {
var echo = {}
;
echo.headers = JSON.stringify(req.headers, true, 2);
echo.body = res;
//console.log(echo);
res.writeHead(200, { 'Content-Type': 'application/json' });
res.write(echo.headers);
req.pipe(echo.body);
});
server.listen(3030);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.