title: Return a file for download request
body: <p>I am trying to make a website to download pdf's (acdemic notes). The
  following code works fine for a single file, but if we have 100 files,
  this way i will need to write the following code for each file. Does anyone have a more efficient way.</p>
  <p><strong>HTML</strong></p>
  <pre><code>&lt;body&gt;
    &lt;form action=&quot;/download&quot; method=&quot;get&quot;&gt;
      &lt;button type=&quot;submit&quot; class=&quot;btn&quot;&gt;Download File1&lt;/button&gt;
      &lt;button type=&quot;submit&quot; class=&quot;btn&quot;&gt;Download File2&lt;/button&gt;
      &lt;button type=&quot;submit&quot; class=&quot;btn&quot;&gt;Download File3&lt;/button&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  <p><strong>JS</strong></p>
  <pre><code>const express = require(&quot;express&quot;);
  const bodyParser = require(&quot;body-parser&quot;);
  const request = require(&quot;request&quot;);
  const path = require('path')
  
  const app = express();
  app.use(express.static(__dirname+&quot;/&quot;));
  app.use(bodyParser.urlencoded({extended: true}));
  
  app.get(&quot;/download&quot;, function(req, res){
    res.download(__dirname+&quot;/Report.pdf&quot;, function(err){
      if(err) console.log(err);
    });
  });
  
  app.get(&quot;/&quot;, function(req, res){
    res.sendFile(__dirname+&quot;/index.html&quot;);
  });
  
  app.listen(3000, function(req, res){
    console.log(&quot;server started at port 3000&quot;);
  });
  </code></pre>