Package Exports
- express-http-proxy
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-http-proxy) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
express-http-proxy

Express proxy middleware to forward request to another host and pass response back
Install
$ npm install express-http-proxy --saveUsage
var proxy = require('express-http-proxy');
var app = require('express')();
app.use('/proxy', proxy('www.google.com', {
forwardPath: function(req, res) {
return require('url').parse(req.url).path;
}
}));
If you only want to proxy get request
app.use('/proxy', proxy('www.google.com', {
filter: function(req, res) {
return req.method == 'GET';
},
forwardPath: function(req, res) {
return require('url').parse(req.url).path;
}
}));You can also intercept the response get by proxy before send it back to the client:
app.use('/proxy', proxy('www.google.com', {
forwardPath: function(req, res) {
return require('url').parse(req.url).path;
},
intercept: function(data, req, res, callback) {
data = JSON.parse(data.toString('utf8'));
callback(null, JSON.stringify(data.obj));
}
}));
Licence
MIT