如何在命令行中运行Express Js / MongoDB并关闭终端

时间:2019-11-14 12:24:53

标签: javascript node.js express

我想知道如何运行快递项目,但隐藏或关闭终端。

如果我关闭终端时服务器掉了,但是我想隐藏它或在本地​​PC上做一个项目,而我不想让用户观看或关闭它而应用程序掉了。

2 个答案:

答案 0 :(得分:0)

使用PM2forever之类的流程管理器。

永久示例命令:computed: { objectList() { const statValues = [ 'OK', 'inProgress', 'Completed', ]; // we need 2 "slice()" - first one is because "sort()" will otherwise modify the list (which is an unwanted side effect for a computed property) // the other "slice()" is the real one that will return the 9 items for the current "page" return this.list.slice().sort((a, b) => { const statA = statValues.indexOf(a.status); const statB = statValues.indexOf(b.status); return statA - statB; }).slice(9 * this.page); } }

答案 1 :(得分:0)

尝试使用nohup <command>

sudo nohup npm start

长版本的答案是使用docker-compose with node js并通过运行以下命令来运行在后台运行的服务: docker-compose up -d <service_name>

相关问题