title: Express res.download()
body: <p>I don't know why it's happening, but it's really annoying. I expected the file to be downloaded according to the <a href="https://expressjs.com/en/api.html#res.download" rel="nofollow noreferrer">express docs</a>. I have the next code:</p>
  
  <pre class="lang-js prettyprint-override"><code>  //in react (App.js)
    download = () =&gt; {
      const { images, target } = this.state;
      const filename = images.find(img =&gt; img.id === target).filename;
      fetch('http://localhost:3001/download', {
        method: 'post',
        headers: {'Content-Type': 'application/json'},
        body: JSON.stringify({filename})
      })
    }
    //in express (server.js)
    app.post('/download', (req, res) =&gt; {
      var file = '../public/images/' + req.body.filename;
      res.download(file, req.body.filename);
    });
  </code></pre>
  
  <p>The folder structure:</p>
  
  <pre class="lang-none prettyprint-override"><code>  -server
      |-server.js
    -public
      |-images
        |-a.jpg
        |-b.jpg
    -src
      |-App.js
  </code></pre>
  
  <p>Nothing's happening, errors not shown. Any ideas?</p>