title: <a hrerf=""> for download files with express and Node.JS
body: <p>With Apache this this really easy, but with Node.JS I don't think so. Simply, I want that when a user click something like this: <code>&lt;a href="/dir/file.png"&gt;</code>, he starts to download the file. When I do that, I'm redirected to <code>http://foo.com/fir/file.png</code>, and I visualize the photo. Also say that I have in the app configure this <code>app.use(express.static(__dirname + '/public'));</code>, so, the file is in the public path, and the public path is declared as static. And, when the users click, I dont want that he will be redirected and then the download starts.</p>
  
  <p>I know this is posible, it's just click a link and a download starts! But I don't know how to do it.</p>
  
  <p>Thank's advance!</p>
  
  <p>EDITED:</p>
  
  <p>The HTML where is the <code>&lt;a href=""&gt;</code>for the download is here:</p>
  
  <pre><code>app.get('/:user/:id', function (req, res){
  
    usermodel.findOne({ user: req.params.user }, function (err, user){
  
     var imagen = user.imagen.id(req.params.id);
  
      if (err) throw err;
  
          res.render('photo.ejs', {
              user: user,
              photo: imagen,
          });
      });
  });
  </code></pre>
  
  <p>Is necessary  to create a new <code>app.get</code>? If I do that, I would get redirected? I'm trying to do this without getting redirected.</p>