Skip to content

Instantly share code, notes, and snippets.

@romgrk
Created January 3, 2017 19:24
Show Gist options
  • Select an option

  • Save romgrk/17b4bd0c573dcb6feba5021e754f0109 to your computer and use it in GitHub Desktop.

Select an option

Save romgrk/17b4bd0c573dcb6feba5021e754f0109 to your computer and use it in GitHub Desktop.
var Service = require('node-windows').Service;
var appPath = require('path').join(__dirname,'\\bin\\www');
// Create a new service object
var svc = new Service({
name:'PlanetPress NodeJS API',
description: 'PlanetPress API service for quote and orders Web interface.',
script: appPath
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
console.log('Installation OK');
console.log('Starting service ...');
svc.start();
});
svc.on('start',function(){
console.log('Service started!');
});
svc.on('uninstall',function(){
console.log('Uninstall complete.');
console.log('The service exists: ',svc.exists);
});
console.log('Installing NodeJS service using location :');
console.log(appPath);
// svc.uninstall();
svc.install();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment