How to serve static file e.g index.html from different server
app.use(express.static('http://example.com/'))
How to serve static file e.g index.html from different server
app.use(express.static('http://example.com/'))
A proxy such as http-proxy-middleware can do this:
var express = require('express');
var proxy = require('http-proxy-middleware');
var app = express();
app.use('/api', proxy({target: 'http://www.example.org', changeOrigin: true}));
app.listen(3000);
// http://localhost:3000/api/foo/bar -> http://www.example.org/api/foo/bar