title: Changing a file directory when using socket.io and node.js?
body: <p>I have created a successful connection and handled events of someone connecting and disconnecting. However I am now trying to clean up my folders to create something that is a bit more clean to work with. </p>
  
  <p>I have looked at some examples of changing directories, however it seems that I am missing something.</p>
  
  <p>I am quite new to using node and socket, so might seem a bit obvious with the problem.</p>
  
  <p>My basic file structure is i have a main app folder, with an index.html file, server folder with all the relevant node and socket code, then a public folder with css, js, image folders.</p>
  
  <p><a href="https://i.stack.imgur.com/luFUj.png" rel="nofollow noreferrer">File Structure</a></p>
  
  <p>So my index is in the route.
  I do also find when I try linking stylesheets and js files it returns a 404 error. Not entirely sure. Any help would be greatly appreciated.</p>
  
  <p><i></p>
  
  <pre><code>// Sets a base path for acessing all files
  app.use(express.static('/'));
  
  app.get("/", function(req, res){
      res.sendFile(__dirname + './index.html');
  });
  </code></pre>
  
  <p></i></p>
  
  <p>EDIT:</p>
  
  <p>Updated file structure:
  <a href="https://i.stack.imgur.com/luFUj.png" rel="nofollow noreferrer">New Structure</a></p>
  
  <p><a href="https://i.stack.imgur.com/luFUj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/luFUj.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/918Sc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/918Sc.png" alt="enter image description here"></a></p>