title: Learning Node - Express Public folder not working
body: <p>So I'm new to node and trying to learn how to use the <code>express</code> library with it. However, the problem I'm trying to figure out is why the files in my <code>/public</code> folder do not seem to be served as static content. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>var http = require('http');
  var port = process.env.port || 1337;
  var express = require('express');
  var handlebars = require('express3-handlebars');
  var path = require('path');
  
  var application = express();
  
  application.use(express.static(path.join(__dirname, 'public')));
  
  application.engine('handlebars', handlebars({ defaultLayout: 'main' }));
  
  application.get('/', function(req, res){
      res.render('index.handlebars', { someProp: 3 });
  });
  
  application.listen(port);
  </code></pre>
  
  <p>And my directory structure:</p>
  
  <pre><code>/
    - server.js (the above referenced file)
    / Views
      - index.handlebars
      / Layouts
        - main.handlebars
    / public
      - ServeMe.txt
  </code></pre>
  
  <p>My understanding was that <code>application.use(express.static(path.join(__dirname, 'public')));</code> was supposed to configure the server to respond to any request under the public folder with that resource if found. What am I doing wrong? Funnily enough, it was easier to configure handlebars as the view engine than to get this public folder working =D</p>
  
  <p>EDIT: The full URL I am trying to request: 
  <code>http://localhost:1337/public/serveme.txt</code></p>
  
  <p>I've tried case sensitivity (which should be a non-issue), and that also did not work. </p>