title: express post request won't get data
body: <p>lately i started to play around with express.js the nodejs web framework. i'm making a simple form that send data to a express route.
  I have a users.js route file and inside that there is a register route.</p>
  
  <p>my user.js route file</p>
  
  <pre><code>router.post('/register', function(req, res, next) {
  
    var name = req.body.name;
    var email = req.body.email;
    var username = req.body.username;
    var password = req.body.password;
    var passwordConfirm = req.body.passwordConfirm;
  console.log(name);
  </code></pre>
  
  <p>my jade file which form is in it</p>
  
  <pre><code>form(method='post',action='/users/register',enctype='multipart/form-data')
          .form-group
            label Name
            input.form-control(name='name',type='text',placeholder='Enter Name')
  and go on ...
  </code></pre>
  
  <p>console.log retunrs undefiend.</p>
  
  <p>my app.js . I used express generator to generate project, as you can see i have multer and bodyparser</p>
  
  <pre><code>var bodyParser = require('body-parser');
  
  var express = require('express');
  var path = require('path');
  var favicon = require('serve-favicon');
  var logger = require('morgan');
   var expressValidator = require('express-validator');
   var cookieParser = require('cookie-parser');
  var session = require('express-session');
  var passport = require('passport');
  var LocalStrategy = require('passport-local').Strategy;
  var multer = require('multer');
  var flash = require('connect-flash');
  var mongo = require('mongodb');
  var mongoose = require('mongoose');
  var db = mongoose.connection;
  
  
  var routes = require('./routes/index');
  var users = require('./routes/users');
  
  var app = express();
  
  // view engine setup
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'jade');
  
  // multer config inja
  var upload = multer({ dest: './uploads' });
  
  
  
  
  // uncomment after placing your favicon in /public
  //app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
  app.use(logger('dev'));
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  
  
  // // handle express session
  app.use(session({
  
    secret: 'secret', //encryption key
    saveUninitialized:true,
    resave:true
  
  }));
  
  // // Passport
  app.use(passport.initialize());
  app.use(passport.session());
  
  
  app.use(expressValidator({
    errorFormatter: function(param, msg, value) {
        var namespace = param.split('.')
        , root    = namespace.shift()
        , formParam = root;
  
      while(namespace.length) {
        formParam += '[' + namespace.shift() + ']';
      }
      return {
        param : formParam,
        msg   : msg,
        value : value
      };
    }
  }));
  
  app.use(cookieParser());
  app.use(express.static(path.join(__dirname, 'public')));
  
  
    // flash messaging via connect-flash
    app.use(flash());
  
  
    app.use(function (req, res, next) {
    res.locals.messages = require('express-messages')(req, res);
    next();
  });
  
  
  app.use('/', routes);
  app.use('/users', users);
  
  // catch 404 and forward to error handler
  app.use(function(req, res, next) {
    var err = new Error('Not Found');
    err.status = 404;
    next(err);
  });
  
  // error handlers
  
  // development error handler
  // will print stacktrace
  if (app.get('env') === 'development') {
    app.use(function(err, req, res, next) {
      res.status(err.status || 500);
      res.render('error', {
        message: err.message,
        error: err
      });
    });
  }
  
  // production error handler
  // no stacktraces leaked to user
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.render('error', {
      message: err.message,
      error: {}
    });
  });
  
  
  module.exports = app;
  </code></pre>