[英]Autostart node.js app with startup options
I would like to autostart my node.js application and server with every boot of the Windows Server 2016 OS.我想在每次启动 Windows Server 2016 OS 时自动启动我的 node.js 应用程序和服务器。
I already found "node-windows" and "qckwinsvc" as possible solutions, but I do not understand how I can start my application with the startup options I saved in the package.json provided below (eg host, prod, ip, max-old-space-size, etc.)我已经找到“node-windows”和“qckwinsvc”作为可能的解决方案,但是我不明白如何使用我保存在 package.json 中提供的启动选项来启动我的应用程序(例如主机、产品、Z9537B5276FCAD28D max-8328)旧空间大小等)
Furthermore, I would like to know if these services also restart the node application in case it crashed due to a programmatical error (eg javascript heap out of memory)此外,我想知道这些服务是否也会重新启动节点应用程序,以防它因程序错误而崩溃(例如 javascript 堆内存不足)
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod --base-href ./",
"build-dev": "ng build --base-href ./",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"app": "ng serve --host=0.0.0.0 --prod --open",
"app-dev": "ng serve --host=localhost --open",
"server": "export NODE_ENV=production && export IP=172.28.0.19 && node --max-old-space-size=4096 server/server.ts",
"server-dev": "export NODE_ENV=development && export IP=localhost && node server/server.ts",
"static": "http-server ./dist/lead -p 8080 -a 0.0.0.0 -o",
"static-dev": "~/.node/lib/node_modules/http-server/bin/http-server ./dist/lead -p 4200 -a localhost -o",
"format": "tslint --fix \"./src/app/**/*.ts\" && tslint --fix \"./server/**/*.ts\" && prettier --write \"./src/app/**/*.{ts,json,css,html}\" && prettier --write \"./server/**/*.ts\" && ng lint"
},
The perfect solution would be to autostart the server and application with all provided startup options and also restart the application in case of a crash.完美的解决方案是使用所有提供的启动选项自动启动服务器和应用程序,并在发生崩溃时重新启动应用程序。
Would be very thankful for any kind of help:)将非常感谢任何形式的帮助:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.