setup a proxy url react 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: set proxy for npm
npm config set proxy http://username:password@host:port
npm config set https-proxy http://username:password@host:port