react setupProxy.js code example
Example 1: react setupproxy
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
app.use(
'/api',
createProxyMiddleware({
target: 'http://localhost:5000',
changeOrigin: true,
})
);
};
Example 2: package json proxy
"proxy": "http://localhost:4000"