title: Loading failed for <scripts> node js
body: <p>I try to use my Room.js in my index.html on the client side of my Node.js server(v10.15.0 + express, socket.io).
  I keep getting errors.
  When I load it via script tags in the index.html file, the console gives me a </p>
  
  <blockquote>
    <p>Loading failed for "script" with .. "Room.js".<br>
     ReferenceError: Room is not defined</p>
  </blockquote>
  
  <p>When I use require in the <strong><a href="https://pastebin.com/g9hu97R3" rel="nofollow noreferrer">app.js</a></strong> like this:</p>
  
  <pre><code>const roomObj = require("./client/js/Room.js");
  const Room = new roomObj();
  </code></pre>
  
  <p>I only get this Error</p>
  
  <blockquote>
    <p>ReferenceError: Room is not defined<br></p>
  </blockquote>
  
  <p><strong><a href="https://pastebin.com/bpZsTCZJ" rel="nofollow noreferrer">Room.js</a></strong><br></p>
  
  <pre><code>module.exports = Room;
  function Room(name, o, obs, ep){
   this.name = name;
   this.o = o;
   this.obs = obs;
   this.getSth = function(ep){}
   this.loadRoom = function(){}
  }
  </code></pre>
  
  <p><strong><a href="https://pastebin.com/5qVUBMq9" rel="nofollow noreferrer">index.html</a></strong><br></p>
  
  <pre><code>&lt;script src="./js/Room.js"&gt;&lt;/script&gt; 
  &lt;script&gt;
   function loadRoom(){
     let room = new Room(name, o, obs, ep);
     room.loadRoom();
   }
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <blockquote>
    <p>Getting 404 Error for Room.js<br></p>
  </blockquote>
  
  <p>When accessing localhost:2000/js/ and following subdirectories I got the</p>
  
  <blockquote>
    <p>Cannot GET /js/
    and the same result for every other Path</p>
  </blockquote>
  
  <p><strong>Solution:</strong> (from Comments in answer)<br>
  replaced line 5-7 in app.js with</p>
  
  <pre><code>app.use(express.static(__dirname + "/client"));
  </code></pre>