title: Issue with serving images from express.js
body: <p>I have issues with serving .png image from my express app. I think there is something wrong with the router setup, because it tries to render page rather than serve a static file. The setup is as follows:</p>
  
  <pre><code>// app.js
  // Module dependencies
  var express = require('express'),
      http = require('http'),
      path = require('path'),
      session = require('./middlewares/session');
  
  // Create server
  var app = module.exports = app ? app : express();
  
  app.set('port', process.env.PORT || 3000);
  app.set('view engine', 'jade');
  app.set('views', __dirname + '/views');
  app.set('view options', { layout: true });
  
  app.use(express.static(path.join(__dirname, '../../public')));
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(express.errorHandler());
  app.use(express.responseTime());
  app.use(express.cookieParser());
  app.use(app.router);
  
  var routes = require('./routes')(app);
  
  if ('development' == app.get('env')) {
      app.use(express.errorHandler());
  }
  
  // Start server
  http.createServer(app).listen(app.get('port'), function() {
      console.log('Express server listening on port ' + app.get('port'));
      console.log(__dirname);
  });
  </code></pre>
  
  <p>Then my routes file looks like this:</p>
  
  <pre><code>// routes.js    
  module.exports = function(app) {
          //Routes
          // app.get('/', routes.index);
          app.get('/api/places', places);
  
          app.get('/add-review', review);
          app.get('/logout', logout);
          app.get('/:location?/:category?', session(app), routes.index);
      }   
  </code></pre>
  
  <p>The jade view where I'm trying to load an image</p>
  
  <pre><code># view
  img(src="/nodeapp/img/logo-white.png")
  </code></pre>
  
  <p>I'm using reverse proxy for node app which root is this <code>http://app.com/nodeapp</code></p>
  
  <p>The folder structure:</p>
  
  <pre><code>public
     components
     css
     img
     js
  server
     srs
        views
        app.js
     test
  </code></pre>
  
  <p>The error that I'm getting is this:</p>
  
  <pre><code>TypeError: Cannot read property 'logo-white.png' of undefined
      at Object.get_listings (/app/server/src/models/vendors.js:354:16)
      at exports.index (/app/server/src/handlers/index.js:6:31)
      at callbacks (/app/node_modules/express/lib/router/index.js:161:37)
      at /app/server/src/middlewares/session.js:13:5
      at /app/bbe/server/src/api.js:18:3
      at _fulfilled (/app/node_modules/requestify/node_modules/q/q.js:798:54)
      at self.promiseDispatch.done (/app/requestify/node_modules/q/q.js:827:30)
      at Promise.promise.promiseDispatch (/app/node_modules/requestify/node_modules/q/q.js:760:13)
      at /app/node_modules/requestify/node_modules/q/q.js:574:44
      at flush (/app/node_modules/requestify/node_modules/q/q.js:108:17)
  GET /img/logo-white.png 500 857ms
  </code></pre>
  
  <p>So, here it's trying to actually render my jade views rather than serving from a static folder. Other static files such as js and css are served fine. Why is this happening? </p>
  
  <p>Thanks!</p>
  
  <p>=== Edit (added function that renders views) ===</p>
  
  <pre><code>exports.index = function(req, res) {  
      res.locals.location = data().get_location(req.params);  
      res.locals.categories =  data().get_categories(res.locals.location);  
      res.locals.listings = data().get_listings(res.locals.location, req.params.category);  
  
      var meta = {  
          title: "My app",  
          module: "/nodeapp/js/core/index/main.js"  
      };  
  
      res.render('nodeapp/index', meta);  
  };
  </code></pre>