I'm separating my project frontend from server side so I have the following folder structure:
- client
- server
Each folder has its own package.json
to separate packages. Now from the client folder I have the following command:
webpack serve --progress --config webpack.config.development.js
And in the server command I have the following command:
nodemon server.js
I want to run both command at the same time, is there is a way to do this while keeping the same folder structure and separation of packages?
CodePudding user response:
Making the folder structure like this:
Project/
├─ client/
├─ server/
├─ run.sh
run.sh:
cd server && nodemon server.js &;
cd ../client && webpack serve --progress --config webpack.config.development.js &;
run the command : ./run.sh
But because we run the applications in the background you need to kill it with
ps -eaf
( for exampleps -eaf | grep server.js
to search within )
I think the best way to do all of this is to use a a process manager like PM2