Skip to content

Instantly share code, notes, and snippets.

@lucarin91
Created July 14, 2016 11:18
Show Gist options
  • Save lucarin91/05b4cab5638e35589dac4889614633b4 to your computer and use it in GitHub Desktop.
Save lucarin91/05b4cab5638e35589dac4889614633b4 to your computer and use it in GitHub Desktop.
Pipe two http request with node.js +Express.js
var app = require('express')();
var http = require('http');
app.get('/', function (req, res) {
http.get('http://127.0.0.1:8000/person',
function (resApi) {
res.writeHead(resApi.statusCode);
resApi.pipe(res);
}
).end();
});
app.listen(8080);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment