title: nodeJS get Error in simple code
body: <p>i'm newbie in nodeJS, after successfully installing socket.io by npm command i'm create simple js as this code:</p>
  
  <pre><code>var app   = require('http').createServer(handler),
      io    = require('socket.io').listen(app),
      fs    = require('fs');
  
  function handler( request, response ) {
  
    fs.readFileSync( __dirname + '/index.html', function( error, data ) {
  
      if( error ) throw error;
      response.writeHead(200);
      response.end( data );
  
    });
  };
  
  app.listen( 1377 )
  io.sockets.on( 'connection', function( socket ) {
    socket.on( 'loginRequest', function( data ) {
      login( data );
    });
  });
  
  function login( data, socket) {
    return socket.emit('loginAnswer', true)
  };
  </code></pre>
  
  <p>this file can be run correctly by <code>node application.js</code> without any problem, now i'm create simple html code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
    &lt;html&gt;
      &lt;head&gt;
          &lt;script src="https://cdn.socket.io/socket.io-1.3.4.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var socket = io('http://localhost');
    socket.on('news', function (data) {
      console.log(data);
      socket.emit('my other event', { my: 'data' });
    });
  &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;form onsubmit='requestLogin()'&gt;
          &lt;input id='username' type='text'&gt;
          &lt;input id='password' type='password'&gt;
          &lt;input type='submit'&gt;
        &lt;/form&gt;
          &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  
  <p>name of this file is index.html, i'm using xampp and both of files are in htdocs root, htdocs is only have this files, now i'm open <code>localhost:1337</code> in browser and i get error</p>
  
  <p>after change address to <code>localhost:1337</code> i get this error:</p>
  
  <pre><code>Unable to connect
  Firefox can't establish a connection to the server at localhost:1337.
  </code></pre>