title: "How to resolve req.body undefined in Node JS "
body: <p>I am setting up a node js server and in my output of req.body i keep getting undefined, i am trying to requesting SQL data from a form Get request</p>
  
  <p>I am able to retrieve other queries just none involving req.body</p>
  
  <pre><code>var bodyParser = require('body-parser');
  var urlencodedParser = bodyParser.urlencoded({ extended: false });
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use(express.static('public'));
  app.use(express.static(__dirname + '/public'));
  
  app.get('/submit',urlencodedParser,function (req, res){
  connection.connect(function (err) {
  if (err) throw err;
  console.log(req.body.lname);
  var exist = req.body.lname;
  var sql = "SELECT * FROM users WHERE lname= '" + exist + "'";
  
  connection.query(sql, function(err,result) {
  if (err) throw err;
  console.log(result);
  console.log(exist);
  console.log(req.body.lname);
  console.log("hello");
  console.log(result);
  });
  });
  </code></pre>
  
  <p>'</p>
  
  <p>output: </p>
  
  <p>undefined
  []
  undefined
  undefined
  hello
  []</p>