简体   繁体   English

在PM2上运行两个React Client

[英]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. 我正在尝试使用从pm2开始的npm运行两个客户端,但是我没有想出一种为每个客户端创建某种别名的方法。 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. 这是我项目中的示例process.json。 Here API is running in 3001 port and storeapp is running on 3000 port. API在3001端口上运行,而storeapp在3000端口上运行。

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

```

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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