I\'m writing an express.js app and would like to serve certain routes from another server.
Express serves some routes starting with api.example.com/v1/*
You can use express-http-proxy
.
And yes, proxying is the accurate term for what you are looking for. It will underneath forward the request to another url, as the API will also imply.
Here's an example usage:
var proxy = require('express-http-proxy');
var app = require('express')();
app.use('/route/you/want/proxied', proxy('proxyHostHere', {
forwardPath: function (req, res) {
return '/path/where/you/want/to/proxy/' + req.url
}
}))