我已经成功地使用pm2、MongoDB和Nginx部署了解析服务器,并且我可以从本地主机外部对其进行发布和获取。我是在DigitalOcean上这样做的,我使用了这个page作为参考。我现在想要将ExpressJS添加到npm全局安装的parse中,但我不知道该怎么做。根据解析教程parse-server-example,我通过手动使用"npm start“让Parse+ExpressJS工作。如何在全局安装中包含它,以便在pm2开始解析时包含它?
这是我的ecosystem.json,如果有用的话。
{
"apps" : [{
"name" : "parse-wrapper",
"script" : "/usr/local/bin/parse-server",
"watch" : true,
"merge_logs" : true,
"cwd" : "/home/parse",
"env": {
"PARSE_SERVER_CLOUD_CODE_MAIN": "/home/parse/cloud/main.js",
"PARSE_SERVER_DATABASE_URI": "mongodb://<user>:<password>@127.0.0.1:27017/dev",
"PARSE_SERVER_APPLICATION_ID": "<myAppId>",
"PARSE_SERVER_MASTER_KEY": "myMasterKey",
}
}]
}
我使用的pm2命令序列是:
pm2 start ecosystem.json
pm2 save
sudo pm2 startup ubuntu -u parse --hp /home/parse/提前感谢你的帮助。
发布于 2020-01-09 13:59:01
根据您的ref repo express已经安装了使用package.json的解析,您可以在index.js中使用express方法
不需要安装express作为全局,因为它已经在package.json文件中提到
要开始使用pm2,可以按如下所示提及脚本参数
script: "npm run start"移动项目根文件夹中的ecosystem.json并运行项目文件夹中的pm2 start命令。
发布于 2020-01-11 07:25:48
我弄清楚了这一点,这是我用来配置pm2的命令序列。
<login as the parse user, or su -l parse>
git clone https://github.com/ppk007/parse-server-example ~/git/parse-server-dev
cd ~/get/parse-server-dev
npm install
<change the config files - I edited index.js>
pm2 start index.js
pm2 save
exit # exit the parse user shell and go to the normal user shell
sudo pm2 startup ubuntu -u parse --hp /home/parse/https://stackoverflow.com/questions/59657922
复制相似问题