Skip to content

Instantly share code, notes, and snippets.

@robertklep
Created July 28, 2017 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertklep/1682ae054ebac9e822a9f0c30ac2ab8f to your computer and use it in GitHub Desktop.
Save robertklep/1682ae054ebac9e822a9f0c30ac2ab8f to your computer and use it in GitHub Desktop.
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