Skip to content

Instantly share code, notes, and snippets.

@franrios
Last active March 27, 2016 13:28
Show Gist options
  • Save franrios/ec40eefa9e520f4b171e to your computer and use it in GitHub Desktop.
Save franrios/ec40eefa9e520f4b171e to your computer and use it in GitHub Desktop.
http-streams.js
var http = require('http')
http.createServer(function (req, res) {
var body = ''
req.setEncoding('utf8')
req.on('data', function (chunk) {
body += chunk
})
req.on('end', function () {
console.log(body)
})
res.end(body)
}).listen(8080)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment