Skip to content

Instantly share code, notes, and snippets.

@ianpetzer
Created November 19, 2013 15:16
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 ianpetzer/7546858 to your computer and use it in GitHub Desktop.
Save ianpetzer/7546858 to your computer and use it in GitHub Desktop.
Node.js passthrough
function passThrough(target) {
return function(req, res) {
req.pipe(request(target+req.path)).pipe(res);
};
}
app.all('/api/*', passThrough("http://localhost:8000"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment