Setting Proxy in package.json for React not working?

Hey guys, I’m trying to create a React app and adding a node server in the same repo. I am following this article: https://www.freecodecamp.org/news/how-to-make-create-react-app-work-with-a-node-backend-api-7c5c48acb1b0/

I’ve added the proxy line in package.json (I think this is where it goes), but my React frontend is still trying to hit localhost:3000 instead of 5k and therefore throwing an error:

What’s going on here?

EDIT: I’ve also tried bringing the “proxy” outside, but to no avail.

Even the docs recommendations don’t work.

1 Like

Mods, you guys can close this, I found the solution.

The proxy was working as intended but wasn’t console logging the proper root. It kept defaulting to the index.html of React and showing http://localhost:3000/api/ instead of http://localhost:5000/api in the console. However, if I console logged the req on the backend in the Node server, the endpoint was getting hit in the terminal. Just a weird nuance here and if anyone has more information I’d like to know.