const proxy = require('http-proxy-middleware');

const proxyConfig = {
  '/api': {
    target: 'http://192.168.101.39:2234',
    changeOrigin: true,
  },
  '/staticResource': {
    target: 'http://192.168.101.39:2234',
    changeOrigin: true,
  },
  '/micro-apps': {
    target: 'http://192.168.101.39:2234/',
    changeOrigin: true,
  },
};

module.exports = function (app) {
  Object.keys(proxyConfig).forEach((key) => {
    app.use(proxy(key, proxyConfig[key]));
  });
};
