title: Correct way to Load JS Files With HTML files through NodeJS
body: <p>I cant get the contents included in the head of the served defualt.htm page to "work".  The html loads in the dom, just the CSS and JS files fail.  Is there a better alternative? Id like to keep the solution within NodeJS but alternatively open to socket.io and express as well. </p>
  
  <p>Thanks, below is what im using.</p>
  
  <p><strong>NodeJS Serving the Page</strong></p>
  
  <pre><code>var http = require('http'),
  fs = require('fs');
  
  fs.readFile(__dirname+'/default.htm', function (err, html) {
      if (err) {
          throw err; 
      }       
      http.createServer(function(request, response) {  
          response.writeHeader(200, {"Content-Type": "text/html"});  
          response.write(html);  
          response.end();  
      }).listen(port.number);
  });
  </code></pre>
  
  <p><strong>Default.html Page</strong></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head lang="en"&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;link rel="stylesheet" href="objects/css/site.css" type="text/css" /&gt;
      &lt;script src="objects/js/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
      &lt;script src="objects/js/site.min.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;&lt;/body&gt;    
  
  &lt;/html&gt;
  </code></pre>