title: nodejs and socket.io.js path resolution
body: <p>I have just started learning nodejs with the socket.io.js library. My question isn't really related to the stuff in these libraries but rather on how the files are served by a visiting browser.</p>
  
  <p>In my server directory there are just 2 files present (index.html and server.js) along with the node_modules directory (for socket.io). In the index.html I have a script tag including the client side socket.io lib as follows,</p>
  
  <pre><code>&lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>The relecvant server code is,</p>
  
  <pre><code>var server = http.createServer(
      function(req, res) {
          res.writeHead(200, { 'Content-type': 'text/html'});
          res.end(fs.readFileSync(__dirname + '/index.html'));
      }
      ).listen(8080, 
      function() {
          console.log('Listening at: http://localhost:8080');
      }
  );
  </code></pre>
  
  <p>My question is where is this file present on the server (there is no socket.io directory in the dir where index.html is present)? So how and from where is this being resolved and downloaded correctly by the web browser?</p>
  
  <p>Sorry for the noob question.</p>