// src/setupProxy.js
const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    '/api',
    createProxyMiddleware({
      target: 'http://localhost:3004/api',
      changeOrigin: true,
      secure: false,
    })
  );
  app.use(
    '/images',
    createProxyMiddleware({
      target: 'http://localhost:3004/images',
      changeOrigin: true,
      secure: false,
    })
  );
  app.use(
    '/files',
    createProxyMiddleware({
      target: 'http://localhost:3004/files',
      changeOrigin: true,
      secure: false,
    })
  );
  app.use(
    '/admin',
    createProxyMiddleware({
      target: 'http://localhost:3004/admin',
      changeOrigin: true,
      secure: false,
    })
  );
};
