title: Referencing external files with a node.js server?
body: <p>I have an Ubuntu 10.04 hosting server which allows me to run <a href="http://nodejs.org" rel="nofollow">node.js</a> off of it.  I'm making an test homepage and I have a few files as follows:</p>
  
  <p><code>index.html</code>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;iSuperMario&lt;/title&gt;
  
      &lt;link rel="stylesheet" href="css/reset.css"&gt;
      &lt;link rel="stylesheet" href="css/style.css"&gt;
  
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script src="/nowjs/now.js"&gt;&lt;/script&gt;
      &lt;script src="js/chat.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="wrapper"&gt;
          &lt;div id="header"&gt;
              &lt;img src="images/green_pipe_960.png"&gt;
              &lt;img src="images/orange_pipe_960.png"&gt;
          &lt;/div&gt;
          &lt;div id="chat"&gt;
              &lt;input type="text" id="text-input"&gt;
              &lt;input type="button" value="Send" id="send-button"&gt;
          &lt;/div&gt;
          &lt;div id="content"&gt;
          &lt;/div&gt;
          &lt;div id="rooms"&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><code>reset.css</code> and <code>style.css</code> (which both just contain styling for the <code>index.html</code> page</p>
  
  <p><code>chat.js</code> (which contains some scripting to implement the barebones chat function for the <code>index.html</code> page)</p>
  
  <p><code>server.js</code> which is a <code>node.js</code> server utilizing <a href="http://nowjs.com/" rel="nofollow">nowjs</a> to serve the <code>index.html</code> page on port <code>8080</code> of the Ubuntu server and to implement the chat function:</p>
  
  <pre><code>var fs = require('fs');
  var server = require('http').createServer(function(req, response){
    fs.readFile(__dirname+'/index.html', function(err, data){
      response.writeHead(200, {'Content-Type':'text/html'});
      response.write(data);
      response.end();
    });
  });
  server.listen(8080);
  var everyone = require("now").initialize(server);
  
  
  everyone.connected(function(){
    console.log("Someone has joined!");
  });
  
  
  everyone.disconnected(function(){
    console.log("Someone has left...");
  });
  
  everyone.now.distributeMessage = function(message){everyone.now.receiveMessage(message);};
  </code></pre>
  
  <p>So, when I view the page from the server in a browser, none of the external resources (<code>reset.css</code>, <code>style.css</code>, <code>chat.js</code>, <code>green_pipe_960.png</code> and <code>orange_pipe_960.png</code>) are connected properly.</p>
  
  <p>How should I enable these?  I mean, if I had to, and it simplified the process a great deal, I could always include the external styles and scripts in <code>index.html</code>.  But, the images could never be embedded (at least I think xD).</p>
  
  <p>Thanks!</p>