When I run "yarn start" it runs only my next application but not my express server.
I have already tried something Like "SET NODE_ENV=production && node server/server.js" but it turns on the develop version (with js not compressed).
Is there a way to use the next build version with the express server?
CodePudding user response:
Yes, you can:
- Next (Frontend, PORT: 3000)
- Express (Backend, PORT: 5000)
- Install
pm2
globally - To run the Next build version, navigate to the project directory then:
pm2 start yarn --name "next" -- start
- To run the Express server, navigate to the server directory then:
pm2 start server.js --name "server"
- Use PM2 configuration file to manage multiple applications.
CodePudding user response:
I just had to use
"start": "export NODE_ENV=production&&node server/server.js"
The export was missing because my OS is redhat. Before I was trying without the export.