title: How to link a script file to an html file using nodeJS
body: <p>I am serving up some html using nodeJS, but I want to be able to call functions that are in a javascript file, which I am trying to link. However, I am getting the error message <code>Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:8888/index.js"</code>. I'm not sure what that won't link properly, and need a way to link my file <code>index.js</code>. What I was trying to do was load the file into the head, as follows: </p>
  
  <pre><code>http = require('http'),
  
  http.createServer(function(req, res) {
  
  var body = '&lt;html&gt;'+
      '&lt;head&gt;'+
      '&lt;script src="index.js"&gt;&lt;/script&gt;'+
      '&lt;meta http-equiv="Content-Type" content="text/html; '+
      'charset=UTF-8" /&gt;'+
      '&lt;/head&gt;'+
      '&lt;body&gt;'+
      '&lt;/body&gt;'+
      '&lt;/html&gt;';
  response.writeHead(200,{"Content-Type":"text/html"});
  response.write(body);
  response.end();
  }
  
  }).listen(8888);
  </code></pre>
  
  <p>How can I load this javascript file, <code>index.js</code>, so that all of the functions contained in <code>index.js</code> will be available on the client side? </p>