Sunday, 12 March 2017

Nodejs webserver use script port 3000

I created a script in nodejs that extract data from database and create a file with all db data. I create also a webserver node js listening on port 3000 and with forever is working in listening mode all time. But now the script is without web interface and use a command line prompt and other modules. How remote users can use a remote script like : node scrip.js like a command shell prompt on locale machine ?

This code working but in-globe only hello world not my prompt command and db retrieve info. Thanks

var app = connect().use(connect.static('public')).listen(3000, "0.0.0.0");
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
 res.end('Hello World\n');
}).listen(3000, '127.0.0.1');
console.log('Server running at http://127.0.0.1:3000/');



via andress

No comments:

Post a Comment