I've an apache web server running on my small ubuntu server box. Lately, I had been trying to understand JavaScript and that i happened upon node.js. Let me produce a couple of web application multiplayer games and I have learnt that node.js could prove useful. I had been going through a couple of difficulties with the configuration. Wouldso would Time passes about running both apache server and node.js on a single machine? I do not mind it when the programs on node.js take presctiption another port and need to be utilized by typing in websitename:portNumber. I'm not very worried concerning the performance advantages/disadvantages, I am much like to accept chance to test JavaScript and node.js. What are the files which need to be modified?

Here's the code I've for that script running around the server (only utilizing it for trial reasons for the time being):

var http = require('http');

 http.createServer(function (req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Hello World\n');
  }).listen(1337);

I began the server (node fileName.js). However, After I attempt to can get on with another client computer around the network, it does not appear to become being employed as the page does not appear to exist.

What's the procedure to ensure that I'm able to get Hello World outputed to my browser after i go to the server on port 1337?

Try to get it done such as this:

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, "your-adapter-ip"); // don't forget adapter IP

After which in the network point your browser to http://your-adapter-ip:1337.
Make certain the firewall is open on that port.

You need to have the ability to browse to http://your_ubuntu_server_ip:1337 in the other client computer.

Are you able to achieve the apache web server in the other computer? If that's the case, you can stop apache, modify your code to make use of port 80, and check out again.