Search code examples
node.jsnpmnodemonnpm-scripts

How to restart multiple server files on npm script using nodemon when changing the files


When I am changing the file on the folder I want to restart the two server files using nodemon in npm script

Here my npm script

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": 
    "nodemon app/api/server.js && nodemon app/backend/server.js"
 },

Solution

  • I finally done that by using concurrently plugin

    And my npm start script will be

    "start": "concurrently \"nodemon app/backend/server.js\" \"nodemon app/api/server.js\" "