title: Getting POST parameters not working
body: <p>I'm trying to send a post parameter (key: test, value: somevlaue) using PostMan using <strong>restify</strong> framework. For this I've used 2 methods and both are not working:</p>
  
  <p>1st one shows this error:</p>
  
  <pre><code>{
    "code": "InternalError",
    "message": "Cannot read property 'test' of undefined"
  }
  </code></pre>
  
  <p>2nd one (commented) shows only Error: someerror</p>
  
  <p>Am I doing something wrong?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>var restify=require('restify');
  var fs=require('fs');
  var qs = require('querystring');
  var bodyParser = require('body-parser');
  var urlencodedParser = bodyParser.urlencoded({ extended: false })
  var controllers = {};
  
  var server=restify.createServer();
  
  server.post("/get", function(req, res, next){
      res.send({value: req.body.test,
       error: "someerror"});
  
      //**********METHOD TWO*********************
  
  /*
       if (req.method == 'POST') {
           var body = '';
  
           req.on('data', function (data) {
               body += data;
           });
  
           req.on('end', function () {
               var post = qs.parse(body);
               res.send({
                   Data: post.test,
                   Error: "Someerror"
               });
           });
       }
       */
  
  });
  server.listen(8081, function (err) {
      if (err)
          console.error(err);
      else
          console.log('App is ready at : ' + 8081);
  });
  </code></pre>