Question

App platform how to deploy react app + nodejs server

Hello guys, i’m facing some problems during my deploy on digitalocean app platform.

i’ve created a react app wich contains a server folder, so i’ve configured the app like so:

  • yarn build as a build command
  • yarn pm2 serve build 8080 --spa (to serve the frontend)
  • yarn pm2 start server/app.js --exp-backoff-restart-delay=100 (to start the BE)

env variables for url: REACT_APP_SERVER_BASE_URL is equal to ${APP_URL}

i can see clearly the frontend, but the app doesnt work, he can’t make api requests to the BE (i see raw html if i hit the login endpoint)

i’m not an expert but i really need your help


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

What you could do is to separate your frontend application and the Node.js backend application into different App components.

Here is a quick video that shows how you could do that:

Hope that this helps!

Best,

Bobby