Created
July 14, 2016 11:18
-
-
Save lucarin91/05b4cab5638e35589dac4889614633b4 to your computer and use it in GitHub Desktop.
Pipe two http request with node.js +Express.js
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
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