My backend runs on localhost:5000 and my frontend on localhost:3000. The proxy I declared in package.json suddenly stopped working today. I fetch using axios in frontend like this:
axios.get('/api/posts')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
// handle error
console.log(error);
})
It fetches from localhost:3000 instead of localhost:5000 even though I have included the proxy in package.json:
{ "proxy": "http://localhost:5000" }
I've tested on other projects too.