title: Node.js : Load .js and .css files included in HTML file without Express/frameworks
body: <p>How can you load the .js .csv and .css files included within an HTML file, displayed with Node.js? (Without frameworks like Express)</p>
  
  <p>E.g. <code>&lt;script src="clock.js"&gt;&lt;/script&gt;</code></p>
  
  <p>In Firefox, it shows that the page, fs.readFile('./index.html'), is requesting clock.js, jquery.js, etc. as html files, probably because of response.writeHead being text/html.</p>
  
  <p>Is there a way to do:</p>
  
  <pre><code>if file included in index.html = .js
  set writeHead to application/javascript
  
  if file included in index.html = .css
  set writeHead to text/css
  </code></pre>
  
  <p>Without specifying in advance what files index.html may include? (e.g. if in the future, index.html also uses menu.js, you wouldn't need to update the node.js script)</p>
  
  <p>Is there a way to see what files are being requested by index.html, then modify the headers of those files (e.g. .js has application/javascript)?</p>