Hi @Elythorix Thanks for bringing this our attention. There are a few things to check to get your Node.js backend communicating properly with your React frontend when deployed to Azure App Service:
- In your local environment, you manually start your server with
node server.js
. In Azure, you need to specify this command in yourpackage.json
under thescripts
section. You can add astart
script like"start": "node server.js"
. This tells Azure how to start your application - Make sure both the React and Node.js apps are deployed to the same App Service instance. They need to share the domain name to communicate.
- In your Node.js app, listen on process.env.PORT for the port instead of a hardcoded one. Azure will assign a port.
- If your frontend and backend are deployed separately, you might run into Cross-Origin Resource Sharing (CORS) issues. Make sure the correct CORS settings are in place in your Azure App Service
Hope that helps.
-Grace