Proxy Middleware for Express

JS
S
JavaScript

Simple example of using `http-proxy-middleware`. https://www.npmjs.com/package/http-proxy-middleware

1const proxyMiddleware = require('http-proxy-middleware');
2const proxyInfo
3
4const app = express();
5
6// proxy api requests
7Object.keys(proxyTable).forEach(function (context) {
8  let options = proxyTable[context]
9  if (typeof options === 'string') {
10    options = { target: options }
11  }
12  app.use(proxyMiddleware(options.filter || context, options))
13})

Created on 2/21/2018