'Host React and Node.js on the same server?

I have a hypothetical question about react and node. Let's say that I have a server where I want to host a react app and its backend application. That server has only port 3000 open to the public (anything open on port 3000 will be available through the URL). Could I run node.js (on let's say port 5000) and run react on port 3000, and make calls to the backend through the localhost:5000?

I'm not sure about this because the react code is hosted on the browser, so would it have access to the backend on that server?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source