0

I'm trying to run two clients with npm start on pm2, but I'm not figuring out a way to create a sort of alias to each of them. They are both running on different ports and I was trying to use

pm2 start npm

on each of them, but it only starts one and ignores the other

tiagomnf
  • 25
  • 4

1 Answers1

0

we can add the list of applications which is running in a different port. This is the sample process.json in my project. Here API is running in 3001 port and storeapp is running on 3000 port.

        {
            "name": "api",
            "script": "./src/api/server/index.js",
            "node_args": "-r esm",
            "watch": ["./config/server.js", "./src/api/server/"],
            "instances": "1",
            "exec_mode": "fork",
            "watch_options": {
                "persistent": true,
                "ignoreInitial": false
            }
        },
        {
            "name": "storeapp",
            "script": "./dist/store/server/index.js",
            "node_args": "-r esm",
            "watch": [
                "./config/server.js",
                "./theme/assets/index.html"
            ],
            "instances": "1",
            "exec_mode": "fork",
            "watch_options": {
                "persistent": true,
                "ignoreInitial": false
            }
        }
    ]
}

```
Jayakumar Thangavel
  • 1,884
  • 1
  • 22
  • 29