title: Nodejs rest api delete function
body: <p>I am writing nodejs rest API. I have problems with my delete function.
  This my html code:</p>
  
  <pre><code>&lt;tr ng-repeat="row in displayedCollection"&gt;
      &lt;td&gt;{{row.FirstNameAuthor}}&lt;/td&gt;
      &lt;td&gt;{{row.LastNameAuthor}}&lt;/td&gt;
      &lt;td&gt;
      &lt;button type="button" ng-click="deleteWriter(row)" class="btn btn-sm btn-danger"&gt;
      &lt;/button&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>This my core.js code:</p>
  
  <pre><code>$scope.deleteWriter = function (row) {
      $http.delete('/writer', $scope.row)
            .error(function (data) {
              console.log('Error: ' + data);
            });
      };
  </code></pre>
  
  <p>This my server.js code:</p>
  
  <pre><code>app.delete('/writer', function (req, res) {
      var reqBody = '';
  
      req.on("data", function (data) {
          reqBody += data;
          if (reqBody.length &gt; 1e7) {//10MB
              httpMsgs.show404(req, res);
          }
      });
      req.on("end", function () {
          wr.delete(req, res, reqBody);
      });
  })
  </code></pre>
  
  <p>Then I use function wr.delete to remove record from database. </p>
  
  <pre><code>exports.delete = function (req, resp, reqBody) { 
  
  try {
      if (!reqBody) throw new Error("Input is nod valid");
      var data = JSON.parse(reqBody);
      if (data) {
          if (!data.idRegisterIssueContract) throw new Error("No such number");
          var sql = "DELETE FROM registerissuecontract ";
          sql += " WHERE idRegisterIssueContract =" + data.idRegisterIssueContract;
          db.executeSQL(sql, function (data, err) {
              if (err) {
                  httpMsgs.show500(req, resp, err);
              }
              else {
                  httpMsgs.send200(req, resp);
              }
  
          });
      }
      else {
          throw new Error("Input is nod valid");
      }
  }
  catch (ex) {
      httpMsgs.show500(req, resp, ex);
  }
  };
  </code></pre>
  
  <p>But it does not work because reqBody is empty.</p>
  
  <p>How can I fixed it?</p>