Skip to content

Instantly share code, notes, and snippets.

@voidnerd
Created December 8, 2017 16:43
Show Gist options
  • Select an option

  • Save voidnerd/a62043ad0ce3dbaff91acec0901e291d to your computer and use it in GitHub Desktop.

Select an option

Save voidnerd/a62043ad0ce3dbaff91acec0901e291d to your computer and use it in GitHub Desktop.
var http = require('http');
var server = http.createServer(function (req, res) {
var body = "";
res.writeHead(200, { 'content-type': 'text/plain' });
if(req.method != 'POST') {
return res.end('Please send a POST\n')
}
req.on('data', (data) => {
body += data.toString();
});
req.on('end', () => {
res.end(body.toUpperCase());
})
});
server.listen(process.argv[2]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment