Skip to content

Instantly share code, notes, and snippets.

@edujr1
Created June 15, 2018 17:59
Show Gist options
  • Save edujr1/b74609b73c004fd0778fb22991b8f152 to your computer and use it in GitHub Desktop.
Save edujr1/b74609b73c004fd0778fb22991b8f152 to your computer and use it in GitHub Desktop.
Usando node-windows para criar um serviço que executa app NodeJS
'use strict'
var Service = require('node-windows').Service;
// Create a new service object
var svc = new Service({
name:'nome-serviço JS',
description: 'Serviço em NodeJS',
script: require('path').join(__dirname,'server.js')
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment