-
-
Save robertklep/1682ae054ebac9e822a9f0c30ac2ab8f to your computer and use it in GitHub Desktop.
This file contains 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
const http = require('http'); | |
const BUFSIZ = 2048; | |
const handler = (req, res) => { | |
req.on('readable', _ => { | |
let chunk; | |
while (null !== (chunk = req.read(BUFSIZ))) { | |
res.write(chunk); | |
} | |
}); | |
req.on('end', () => { | |
res.end(); | |
}); | |
}; | |
http.createServer(handler).listen(3001); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment