title: TypeError: next is not a function
body: <p>I'm running a Node.js-server and trying to test this Rest API that I made with Express. It's linked up to MongoDB using Mongoose.</p>
  
  <p>I'm testing the individual routes using Postman and I get an error when trying to send a PUT-request to this route:</p>
  
  <pre><code>// PUT /meetings/:id
  // Route for editing a specific meeting
  router.put("/:id", function(req, res, next) {
      req.meeting.update(req.date, function(err, result) {
        if(err) return next(err);
        res.json(result);
      });
  });
  </code></pre>
  
  <p>The error retrieved is this:</p>
  
  <pre><code>events.js:141
        throw er; // Unhandled 'error' event
        ^
  
  TypeError: next is not a function
  </code></pre>
  
  <p>I cannot figure out where exactly this is coming from. I'm using the router.params-method to specify how the :id-parameter should be handled like this:</p>
  
  <pre><code>router.param("id", function(req, res, id, next) {
    Meeting.findById(id, function(err, meeting) {
      if (err) return next(err);
      if (!meeting) {
        err = new Error("Meeting not found");
        err.status = 404;
        return next(err);
      }
      req.meeting = meeting;
      return next();
    });
  });
  </code></pre>