Created
May 24, 2016 19:22
-
-
Save djedi/99cdb0ded584aca9b2a0bf1c3aa86c86 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'); | |
http.createServer( | |
function (req, res) { | |
var body = []; | |
req.on('error', function(err) { | |
console.error('error', err); | |
}).on('data', function(chunk) { | |
body.push(chunk); | |
}).on('end', function() { | |
body = Buffer.concat(body).toString(); | |
console.log(body); | |
}); | |
res.writeHead(200, { | |
'Content-Type': 'text/plain', | |
'Access-Control-Allow-Origin': '*' | |
}); | |
res.end('Zzzz...\n'); | |
} | |
).listen(3000, '0.0.0.0'); | |
console.log('Server running at http://127.0.0.1:3000'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment