Created
June 15, 2018 17:59
-
-
Save edujr1/b74609b73c004fd0778fb22991b8f152 to your computer and use it in GitHub Desktop.
Usando node-windows para criar um serviço que executa app NodeJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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