I loved what [Corey][1] did in [node-windows][2]. He shows that in [this answer][3] and I'm copying his steps below:
[![enter image description here][4]][4]
> It also has system logging built in.
[![enter image description here][5]][5]
> There is an API to create scripts from code, i.e.
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'Hello World',
description: 'The nodejs.org example web server.',
script: 'C:\\path\\to\\helloworld.js'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
It does even have a way to restart the service and increase the service's restart time.
[1]: https://stackoverflow.com/users/720822/corey "Corey"
[2]: https://github.com/coreybutler/node-windows "node-windows"
[3]: https://stackoverflow.com/a/18584217/4519548
[4]: https://i.stack.imgur.com/Oprfo.png
[5]: https://i.stack.imgur.com/kWmYd.png
Late to the party, but [node-windows](http://github.com/coreybutler/node-windows) will do the trick too.
![enter image description here][1]
It also has system logging built in.
![enter image description here][2]
[1]: http://i.stack.imgur.com/03dwk.png
[2]: http://i.stack.imgur.com/5kVN1.png
There is an API to create scripts from code, i.e.
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'Hello World',
description: 'The nodejs.org example web server.',
script: 'C:\\path\\to\\helloworld.js'
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
FD: I'm the author of this module.