title: Node.js with express.js returns 500 to ajax call
body: <p>I have a cordova project where I do the following request.</p>
  
  <pre><code>$("#asd").on("click",function(){
      var data = {};
      data.title = "title";
      data.message = "message";
  
      $.ajax('127.0.0.1:3000/register', 
      {
          type: 'POST',
          data: JSON.stringify(data),
          contentType: 'application/json',
          success: function() { console.log('success');},
          error  : function() { console.log('error');}
      });
  });
  </code></pre>
  
  <p>Server side code:</p>
  
  <pre><code>var express = require('express');
  var app = express();
  
  app.use(express.bodyParser());
  
  
  app.post('/register', function(req, res){
      var obj = {};
      console.log('body: ' + JSON.stringify(req.body));
      res.send(req.body);
  });
  
  
  app.listen(3000);
  </code></pre>
  
  <p>But I get <code>Internal Server Error 500</code> when I send the request. If I make a request simply by an html form or curl it just works fine. </p>
  
  <p>What might be the cause of this?</p>