title: How do I send multiple files with expressjs?
body: <p>I want to be able to send many files, and if possible the a whole directory so that I can access it in my other js file that is getting called from an html file.</p>
  <pre><code>const app = require(&quot;express&quot;)();
  const http = require(&quot;http&quot;).Server(app);
  const io = require(&quot;socket.io&quot;)(http);
  const port = process.env.PORT || 3000;
  
  app.use(&quot;/styles&quot;, express.static(__dirname));
  
  app.get(&quot;/&quot;, function (req, res) {
    //res.sendFile(&quot;C:/Users/Kevin_Who/Desktop/Online Chat Game/index.html&quot;);
    //res.sendFile(&quot;C:/Users/Kevin_Who/Desktop/Online Chat Game/mainScript.js&quot;);
    res.sendFile(&quot;C:/Users/Kevin_Who/Desktop/Online Game Files/&quot;);
    //app.use(express.static(&quot;Online Game Files&quot;));
  });
  </code></pre>
  <p>I tried sending many files with res.sendFile, but it only sends the first one. In the html file it references mainScript.js inside a script tag (<code>&lt;script src=&quot;mainScript.js&quot; type=&quot;module&quot;&gt;&lt;/script&gt;</code>). Inside the mainScript.js it also references image files, and I need help finding how to send and access these files(<code>tiles[2].src = &quot;./Assets/Blocks/StoneBrickWall.png&quot;;</code>).</p>