Created
December 8, 2017 16:43
-
-
Save voidnerd/a62043ad0ce3dbaff91acec0901e291d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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