title: Nodejs & express can't find public folder
body: <p>My node.js app can't find the public folder. I've tried using connect static and express static from this answer: <a href="https://stackoverflow.com/questions/10434001/static-files-with-express-js">static files with express.js</a> and also this answer: <a href="https://stackoverflow.com/questions/17575492/file-not-found-in-node-js">File not found in Node.js</a> </p>
  
  <p>But I still can't get it working. I get the content of the page I try to display, but not any of the links to css and js files.</p>
  
  <p>Any ideas?
  This is my app.js file.</p>
  
  <pre><code>var express = require('express'),
  post = require('./routes/posts'),
  web = require('./routes/web'),
  http = require('http'),
  stylus = require('stylus'),
  nib = require('nib'),
  path = require('path');
  
  var app = express();
  
  function compile(str, path) {
      return stylus(str).set('filename', path).use(nib());
  }
  
  app.configure(function () {
  
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  
  app.use(express.logger('dev'));
  app.use(express.json());
  app.use(express.urlencoded());
  app.use(express.multipart());
  app.use(app.router);
  app.use(stylus.middleware({src: __dirname + '/public', compile: compile}));
  app.use(express.static(path.join(__dirname, 'public')));
  app.use(express.bodyParser({ keepExtensions: true, uploadDir: __dirname + '/upload/photos' }));
  });
  
  //app.use(app.router);
  
  //Web
  app.get('/',        web.frontPage); 
  
  app.post('/posts',           post.findAllPosts);
  app.post('/posts/:id',       post.findPostById);
  app.post('/postAdd',          post.addPost);
  app.put('/posts/:id',       post.updatePost);
  app.delete('/posts/:id',    post.deletePost); 
  
  app.get('*', function(req, res){
      res.render('404');
  });
  
  http.createServer(app).listen(80);
  console.log('Listening on port 80...');
  </code></pre>