start forever command on ubuntu to run js file

316 Views Asked by At

I have installed forever and forever-monitor on ubuntu in below path /var/www/html/node_modules

Now I try to start file which is at this path /var/www/html/ with name test.js: forever start test.js

But nothing happens. I have globally installed forever. Where am I wrong?

in test.js i have this js code:

var http = require('http');

http.createServer(function (request, response) {
  response.writeHead(200, {'Content-Type': 'text/plain'});
  response.end('testing. . .\n');
}).listen(8124);

console.log('Server running...');

tried this command ps -eaf | grep node and output:

root     17101 16778  0 06:32 pts/0    00:00:00 nodejs chat_client.js
root     17318 16778  0 07:07 pts/0    00:00:00 nodejs my_queue_worker.js
root     17326 16778  0 07:08 pts/0    00:00:00 nodejs chat_client.js
root     17808 16778  0 07:50 pts/0    00:00:00 grep --color=auto node
0

There are 0 best solutions below