title: getting form data in node js:undefined error while submitting form
body: <p>I am trying to get data from a form using express js.But i will get an undefined error in my console.
  here is my html</p>
  
  <pre><code>&lt;form action="/login" method="post"&gt;
  &lt;label&gt;Username&lt;/label&gt;
  &lt;input type="text" name="username" value=""&gt;&lt;br&gt;&lt;br&gt;
  &lt;label&gt;Password&lt;/label&gt;
  &lt;input type="password" name="password" value=""&gt;&lt;br&gt;&lt;br&gt;
  &lt;input type="submit" name="" value="Login"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><strong>index.js</strong></p>
  
  <pre><code>    var app = require('express')();
      var url = require('url');
      var server = require('http').Server(app);
      var io = require('socket.io')(server);
      var mongoose=require('mongoose');
      var path = require('path');
      var express = require('express');
      var bodyParser = require('body-parser');
      app.set('views', path.join(__dirname, 'views'));
      app.set('view engine', 'ejs');
      app.use(bodyParser.json());
      app.use(bodyParser.urlencoded({ extended: false }));
  // for login 
      app.post('/login',function(req,res){
       console.log("server"+req.body.username+req.body.password);
      });
  </code></pre>
  
  <p>I will get undefined error in my console,also i have installed body-parser in my  application.</p>