title: Javascript Files Loading With Errors in NodeJS
body: <p>I've recently started using Visual Studio 2019 and am trying to build a Javascript WebApp with NodeJS and p5. I'm not sure if there is a special procedure for this, but for some reason, the Javascript files linked to HTML page are outputting errors.</p>
  
  <p>This is my Javascript file 'server.js'. It worked fine before I added the script to the HTML file, so I don't <em>think</em> this is the problem.</p>
  
  <pre><code>'use strict';
  var http = require('http');
  var port = process.env.PORT || 80;
  var fs = require('fs');
  
  http.createServer(function (request, response) {
      response.writeHead(200, { 'Content-Type': 'text/html' });
      fs.readFile('./index.html', null, function (error, data) {
          if (error) {
              response.writeHead(404);
              response.write("File not found.");
          } else {
              response.write(data);
          }
          response.end();
      });
  }).listen(port);
  </code></pre>
  
  <hr>
  
  <p>This is the HTML file with the script loaded in.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8" /&gt;
      &lt;title&gt;~~ Tetris ~~&lt;/title&gt;
      &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.js"&gt;&lt;/script&gt;
      &lt;script src="sketch.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <hr>
  
  <p>And this is a screenshot of the console output when I open the Firefox web server.</p>
  
  <p><a href="https://i.stack.imgur.com/wNzBS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wNzBS.png" alt="this"></a></p>
  
  <p>I'd really appreciate the help, thanks in advance.</p>