I am using forever-monitor nom module to run sample.js script forever. I am trying to send arguments from index.js(where I am using below code to initialize forever-monitor module) to target script i.e. sample.js. There is an option for this i.e. args however, when I am trying to send arguments with this option and access that argument in sample.js file it returns undefined. How can I pass argument and access it in target script using forever-monitor?
let forever = require('forever-monitor');
let child = new (forever.Monitor)(‘sample.js', {
'silent': false,
'args': ['foo']
});
child.on('exit', () => {
console.log(‘sample.js has exited.’);
});
child.start();
UPDATE
Since I am passing arguments from one javascript file to another not from command line for that reason it is not a duplicate.