简体   繁体   中英

Running two react clients on PM2

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

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
            }
        }
    ]
}

```

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM