title: 404 error when using response.sendfile in Express.js
body: <p>I have an Express Node.js application. The structure is the following:</p>
  
  <pre><code>myapp
    +-- node_modules
    +-- public
           |-- htmls
                 |-- myhtml.html
    +-- routes
           |-- index.js
    |-- app.js
  </code></pre>
  
  <p>My <code>app.js</code> is as follows:</p>
  
  <pre><code>var express = require('express')
    , routes = require('./routes')
    , user = require('./routes/user')
    , http = require('http')
    , path = require('path');
  
  var app = express();
  
  // all environments
  // some stuff...
  app.use(express.static(path.join(__dirname, 'public')));
  app.use('/public', express.static(path.join(__dirname, 'public')));
  
  app.get('/', routes.index);
  app.get('/content/:file', routes.plainhtml);
  
  http.createServer(app).listen(app.get('port'), function(){
    console.log('Express server listening on port ' + app.get('port'));
  });
  </code></pre>
  
  <p>My <code>routes/index.js</code> is as follows:</p>
  
  <pre><code>// Some stuff...
  exports.plainhtml = function(req, res) {
    res.sendfile('/public/htmls/' + req.params.file);
  };
  </code></pre>
  
  <p>I open my browser and try to get the following address: <code>http://localhost:3000/content/myhtml.html</code> and I get 404 error:</p>
  
  <blockquote>
    <p>Express 404 Error: ENOENT, stat '/public/htmls/myhtml.html'</p>
  </blockquote>
  
  <p>The routing is done and the function is called... the problem is when I try to use <code>res.sendfile</code>. What address should I pass there???</p>
  
  <p>What to do?</p>