title: nodejs req.body undefined in case of ajax post requests
body: <p>Strange issue and I have no explanation to that. I create ajax post request</p>
  <pre><code> $.ajax({  
          type: &quot;POST&quot;,  
          url: &quot;/like&quot;,  
          data: {&quot;topic&quot;: &quot;123123&quot;},  
          success: function(dataString) {               
              console.log('123123'); 
          }  
      }); 
  </code></pre>
  <p>Or like this:</p>
  <pre><code>var xhttp = new XMLHttpRequest(); 
  xhttp.open(&quot;POST&quot;, &quot;/like&quot;, true);
  xhttp.setRequestHeader(&quot;Content-type&quot;, &quot;application/x-www-form-urlencoded&quot;);
  xhttp.send(&quot;fname=Henry&amp;lname=Ford&quot;); 
  </code></pre>
  <p>on server side (NodeJs) I have simple code</p>
  <pre><code>app.post('/like', function (req, res) {
      console.log(req.body);
      res.status(201).send('+1')
  });
  </code></pre>
  <p>what I dont understand, is why I receive all the time undefined when I send ajax post request.</p>
  <p><a href="https://i.stack.imgur.com/Qdo1x.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qdo1x.png" alt="enter image description here" /></a></p>