title: Node.js/Express form post req.body not working
body: <p>I'm using express and having trouble getting form data from the bodyParser.  No matter what I do it always comes up as an empty object.  Here is my express generated app.js code (the only thing I added was the app.post route at the bottom):</p>
  
  <pre><code>var express = require('express');
  
  var app = module.exports = express.createServer();
  
  // Configuration
  
  app.configure(function(){
      app.set('views', __dirname + '/views');
      app.set('view engine', 'jade');
      app.use(express.bodyParser());
      app.use(express.methodOverride());
      app.use(app.router);
      app.use(express.static(__dirname + '/public'));
  });
  
  app.configure('development', function(){
      app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); 
  });
  
  app.configure('production', function(){
      app.use(express.errorHandler()); 
  });
  
  // Routes
  
  app.get('/', function(req, res){
      res.sendfile('./public/index.html');
  });
  
  app.post('/', function(req, res){
      console.log(req.body);
      res.sendfile('./public/index.html');
  });
  
  app.listen(3010);
  </code></pre>
  
  <p>Here is my HTML form:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
    &lt;body&gt;
  &lt;form id="myform" action="/" method="post" enctype="application/x-www-form-urlencoded"&gt;
    &lt;input type="text" id="mytext" /&gt;
    &lt;input type="submit" id="mysubmit" /&gt;
  &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When I submit the form, req.body is an empty object {}</p>
  
  <p>Its worth noting that this happens even if I remove the enctype attribute from the form tag</p>
  
  <p>...Is there something I am missing/doing wrong?</p>
  
  <p>I am using node v0.4.11 and express v2.4.6</p>