title: Empty Node.js/Express response
body: <p>I have a POST request that I want to process:</p>
  
  <pre><code>var app = require('express')();
  var bodyParser = require('body-parser');
  app.use(bodyParser());
  . . .
  app.post('/signup', function(req, res) {
      console.log('name: ' + req.body.name);
      console.log('email: ' + req.body.email);
      . . .
  });
  </code></pre>
  
  <p>All seems well and dandy.</p>
  
  <p>My client:</p>
  
  <pre><code>&lt;html&gt;&lt;body&gt;
      &lt;form&gt;
      Name:&lt;br&gt;
      &lt;input type="text" name="name"&gt;&lt;br&gt;
      Email:&lt;br&gt;
      &lt;input type="text" name="email"&gt;&lt;br&gt;
      &lt;input id="submit" type="submit" value="Submit"&gt;
      &lt;/form&gt;
  
  &lt;script type="text/javascript" src="https://code.jquery.com/jquery-3.0.0.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $('input#submit').click(function() {
      $.ajax({
          url: 'http://localhost:5000/signup',
          type: 'post',
          dataType: 'json',
          data: $('form').serialize(),
          success: function(data) {
              console.log('response:', data);
          }
      });
      return false;
  });
  &lt;/script&gt;&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>The problem? <code>success</code> is never called in the client. Eventually, Chrome JS-debug window shows: <code>net::ERR_EMPTY_RESPONSE</code>.</p>
  
  <p>I have tried doing <code>res.send(200)</code>, <code>res.send('')</code> and <code>res.end()</code> in the server, but without success.</p>
  
  <p>My Node.js version is 4.2.6, and I think my Express version is 4.4.1.</p>