I created a simple http server in Node.js.
I wanted to make it run permanently on my Windows 2008 machine, so that, if the computer reboots, it automatically restarts.
So I made it a service with this command:
C:\Users\Administrator>sc create translate binPath= "node D:\Apps\translate\machine-learning-server\servertranslate.js" DisplayName= "Translation Server"
Then started it with:
C:\Users\Administrator>sc start translate
and got the following error message:
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.
The program works OK when I start it from the command line (not as a service).
What is the easiest way to have a node.js web server that restarts automatically when the computer reboots?
The Node. js framework can be used to develop web servers using the 'http' module. The application can be made to listen on a particular port and send a response to the client whenever a request is made to the application.
Node. js has a built-in module called HTTP, which allows Node. js to transfer data over the Hyper Text Transfer Protocol (HTTP).
In the past, I've used NSSM for running Node.js applications as services on Windows. It works quite well, and can be configured to automatically restart your application in the event of a crash.
http://nssm.cc/usage
nssm install YourService "C:\Program Files\Node.js\node.exe" "C:\something\something.js"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With