title: Node.js posting undefined
body: <p>I am trying to post and insert data from <code>html</code> form using <code>node.js</code> but I am having problem posting data from <code>HTML</code> form to <code>node.js</code> and extracting the data passed it always undefined for inserting in database using <code>node-mysql</code> I am new with <code>node.js</code></p>
  
  <p>Here is my <code>app.js</code> code</p>
  
  <pre><code>var app = require('express')();
  var server = require('http').Server(app);
  var io = require('socket.io')(server);
  var bodyParser = require('body-parser');
  var jsonParser = bodyParser.json()
  var sql = require('mysql');
  
  var connection = sql.createConnection({
   host     : 'localhost',
   user     : 'root',
   password : '',
   port     : '3306',
   database : 'node'
  });
  
  server.listen(3000);
  
  app.get('/nodeThis', function (req, res) {
    res.sendFile(__dirname + '/insert.html');
  });
  
  app.use(bodyParser.json())
  app.post('/nodeThis', jsonParser, function (req, res) {
  
  var post={user_name:req.body.name1,user_what:req.body.what,user_why:req.body.why};
  console.log(post);
  
   });
  </code></pre>
  
  <p>Here is my <code>HTML</code> form:</p>
  
  <pre><code>&lt;html&gt;
      &lt;body&gt;
          &lt;div&gt;   
              &lt;form action="/nodeThis" method="post"&gt;
                  &lt;input type="text" name="name1"&gt;
                  &lt;input type="text" name="what"&gt;
                  &lt;input type="text" name="why"&gt;
                  &lt;button class="boom"&gt;Submit&lt;/button&gt;
              &lt;/form&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>