title: How to link files in NodeJS (+ let the user download the file when clicking it)?
body: <p>I guess it is just a simple question but I can't solve it on my own.</p>
  
  <p>(I'm using Express + NodeJS)</p>
  
  <p>What I would like to have is a directory listing with the files contained in it. The files shall be linked so that a user could download them by just clicking the link (like the standard directory listing you get if you have e.g. a apache server without any index file).</p>
  
  <p>To list the directory content I use</p>
  
  <pre><code>var fs = require('fs');
  fs.readdir('./anydir', function(err, files){
      files.forEach(function(file){
          res.send(file);
      });
  });
  </code></pre>
  
  <p>(Notice: I did not include any error handling in this example as you can see)</p>
  
  <p>Now I tried to just link the file by modifying the</p>
  
  <pre><code>res.send(file)
  </code></pre>
  
  <p>to</p>
  
  <pre><code>res.send('&lt;a href=\"' + file + '\"&gt;' + file + '&lt;br&gt;');
  </code></pre>
  
  <p>but this just prints out the error message:</p>
  
  <pre><code>Cannot GET /anydir/File
  </code></pre>
  
  <p>... because I did not handle every file request in app.js.</p>
  
  <p>How can I achieve my goal mentioned above?</p>