I am hoping to use a front end written in React, with a small PHP backend that will only be called by the React site - the reason for the backend is that I need to make a call to an external API and don’t want to expose the API key in requests that will be visible client-side, so React will make a REST web request to the PHP service, which will then make a request to the external API. If I’m understanding other topics on APIs, this should be possible and allowed as long as the React site and PHP API are on the same domain.
If that’s the case, how can I find out the ports that the React site and the PHP backend will use?
Apologies if it was a stupid question, this is the first website I’ve created since a very basic HTML/JS/CSS one in the “web 1.0” days. I probably confused myself slightly because during local development I needed two dev servers, one for node/react and one for PHP, which required different ports. Anyhow, the production site is now up and running
During local development, you usually run React through a small Node.js development server that can immediately recompile your website when you change the source code and reload the web page. On your live site, you just want to build the website once and upload the generated files.
And depending on how what development server you use, it’s common to run a web server on a high port like 8000 or 8080 due to permissions associated with default ports. But on your live site, your application should always run on the default port because it’s cleaner and avoids issues with restrictive firewalls.