3

I am trying to serve my node.js and react application with pm2 including loading data from mongoDB. So far I can serve the build with serve -s build -l 3001 i am using port 3001 for the front end. And pm2 start server.js for the backend which runs on port 3000. This runs and loads data successfully.

However, instead of using pm2 start server.js I want to be able to run pm2 serve build/ 3000 with my app name however when I do this my web page turns blank, all responses are 200 and there is nothing in the logs. I have also checked online and searched many resources all result back to exactly what i am currently doing.

I am using npm run build to create my build folder.

Does anyone know a way to successfully serve your react build directory with pm2 ?

Thank you!

Joshua
  • 1,005
  • 1
  • 11
  • 16

0 Answers0