title: Express.js req.body undefined
body: <p>I have this as configuration of my Express server</p>
  
  <pre><code>app.use(app.router); 
  app.use(express.cookieParser());
  app.use(express.session({ secret: "keyboard cat" }));
  app.set('view engine', 'ejs');
  app.set("view options", { layout: true });
  //Handles post requests
  app.use(express.bodyParser());
  //Handles put requests
  app.use(express.methodOverride());
  </code></pre>
  
  <p>But still when I ask for <code>req.body.something</code> in my routes I get some error pointing out that <code>body is undefined</code>. Here is an example of a route that uses <code>req.body</code> :</p>
  
  <pre><code>app.post('/admin', function(req, res){
      console.log(req.body.name);
  });
  </code></pre>
  
  <p>I read that this problem is caused by the lack of <code>app.use(express.bodyParser());</code> but as you can see I call it before the routes.</p>
  
  <p>Any clue?</p>