In CRA 2.0 proxy property on the package.json does not work. After some research, I came across an article suggesting to use http-proxy-middleware
. I created an setupProxy.js
in the src of my client folder(React side). That contains the following code
const proxy = require("http-proxy-middleware");
module.exports = function(app) {
console.log("Setup proxy is ever called");
app.use(proxy("/api/auth/google", { target: "http://localhost:5000/" }));
};
What am I supposed to do after this. Where should I import the setupProxy.js
file. From where it is gonna receive app
.