learnyounode
Version:
Learn You The Node.js For Much Win! An intro to Node.js via a set of self-guided workshops.
16 lines (12 loc) • 344 B
JavaScript
const http = require('http')
const map = require('through2-map')
const server = http.createServer(function (req, res) {
if (req.method !== 'POST') {
return res.end('send me a POST\n')
}
req.pipe(map(function (chunk) {
return chunk.toString().toUpperCase()
})).pipe(res)
})
server.listen(Number(process.argv[2]))