title: Undefined while sending post nodejs
body: <p>I try to send a form with data in my nodejs app but I get "undefined" I am not sure does it matter but in console first I see "undefined", then POST. I have tried some "fixes" from the Internet like adding "type:'application/*+json', inflate: false" to app.use(bodyParser.json...) but nothing worked for me... </p>
  
  <pre><code>Undefined
  POST /users/register 200 32.777 ms - 2346
  </code></pre>
  
  <p>this is my routes/users.js file: </p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  
  router.get('/register', function(req, res, next) {
    res.render('register', {
      'title': 'Register'
    });
  });
  
  router.post('/register', function(req, res, next) {
    console.log(req.body.name);
  });
  
  module.exports = router;
  </code></pre>
  
  <p>heres my jade file</p>
  
  <pre><code>form(method='post', action='/users/register', role='form')
          .form-group
              label Name
              input.form-control(type='text', name='name', placeholder='Enter Name')
          input.btn.btn-default(name='submit', type='submit', value='Register')
  </code></pre>
  
  <p>and app.js</p>
  
  <pre><code>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 bodyParser = require('body-parser');
  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();
  
  app.set('views', path.join(__dirname, 'views'));
  app.set('view engine', 'jade');
  
  app.use(logger('dev'));
  app.use(bodyParser.json({ type: 'application/*+json' }));
  
  app.use(session({
    secret: 'secret',
    saveUninitialized: true,
    resave: true
  }));
  
  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')));
  
  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);
  
  app.use(function(req, res, next) {
    var err = new Error('Not Found');
    err.status = 404;
    next(err);
  });
  
  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
      });
    });
  }
  
  app.use(function(err, req, res, next) {
    res.status(err.status || 500);
    res.render('error', {
      message: err.message,
      error: {}
    });
  });
  
  
  module.exports = app;
  </code></pre>
  
  <p>Routing works fine what show setting up a title to "Register", but I have problems with sending post :/</p>