David Brierton
David Brierton

Reputation: 7397

Installing Node.js on server accessing node from another computer on the same network

I have uploaded node.js on my server. How do I call node.js from another computer on the same network? I created node-test.js and run it on the server which will show Hello World. But when I go to the url on another computer on the same network the page is not found? Will someone please help me with this?

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World!n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

Upvotes: 1

Views: 173

Answers (1)

saikumar
saikumar

Reputation: 1051

go to cmd prompt, check ipconfig, then use that ip with port number 1337, use only listen(1337) .

Upvotes: 3

Related Questions