I am trying to create a chat app using reactJS and pusher, i am getting this error-
Could not proxy request /pusher/auth from localhost:3000 to http
In server directory
npm install --save http-proxy-middleware
then create a file with this name : setupProxy.js in src directory of client react folder
then add the following
const proxy = require("http-proxy-middleware");
module.exports = function(app) {
app.use(proxy("/api/**", { // https://github.com/chimurai/http-proxy-middleware
target: "http://localhost:5000",
secure: false
}));
};
In proxy configuration make sure you are matching any path with double ** not only *
Note: you are not going to require this proxy anywhere else just like that
Note: remove any other proxy settings in package.json For more check this reference