title: The server stops working if I wrap express.static in a function
body: <p>the code below works:</p>
  
  <pre><code>var express = require('express');
  var path  = require('path');
  var app = express();
  app.use('/public', express.static("./public"));
  app.listen(3000, function () {
      console.log('Example app listening on port 3000!');
  });
  </code></pre>
  
  <p>But if I change the <code>app.use</code> like this: </p>
  
  <pre><code>var express = require('express');
  var path  = require('path');
  var app = express();
  app.use('/public', function(){express.static("./public")}); 
  // browser error "cannot GET /
  app.listen(3000, function () {
      console.log('Example app listening on port 3000!');
  });
  </code></pre>
  
  <p>Why? The server doesn't seem to catch any errors</p>