i am creating a windows service that adds some data randomly to a database , so i used node-windows to implement it and when i run the file it creates an executable file and when i run that file i get "cannot start service from the command line or a debugger. a windows service must first be installed" what should i do ??
here is the app.js file code :
var Service = require('node-windows').Service;
var svc = new Service({
name:'finaltest',
description: 'The nodejs.org example web server.',
script: 'testapp.js',
});
// Listen for the "install" event, which indicates the
// process is available as a service.
svc.on('install',function(){
svc.start();
});
svc.install();
and this is the testapp.js file code :
var test = require('./models/test') ;
test.create({test : Math.random()}).then( () => {
console.log('hey') ;
})
setInterval(function(){
test.create({test : Math.random()}).then( () => {
console.log('hey') ;
})
}, 60000);