I\'m trying to \"proxy\" some file with an express app. Why the code below doesn\'t work?
var app = require(\'express\')()
var request = require(\'superagent
A superagent's response object should not be treated as a stream, because it may already be the result of automatic serialization (e.g. from JSON to a JavaScript object). Rather than using the response object, the documentation on piping data states that you can directly pipe the superagent request to a stream:
var app = require('express')()
var request = require('superagent')
app.get('/image', function(req, res, next) {
request('http://s3.amazonaws.com/thumbnails.illustrationsource.com/huge.104.520060.JPG')
.pipe(res)
})
app.listen(3001, function() {
console.log('listen')
})