title: Unresolved function or method post() Express 4.x Router
body: <pre><code>var express = require('express');
  var router = express.Router();
  
  var messages = [];
  
  router.get('/',function(req,res){
      res.render('index');
  });
  
  // Method 1
  router.route('/send')
      .all(function (req, res, next) {
          next();
      })
      .post('/send', function (req, res) { // unresolved function or method post()
          console.log("Message sent");
          var msg = req.body.message;
          if (msg != '') {
              messages.push(msg);
          }
          res.redirect('/');
      });
  
  // Method 2
  router.post('/send', function (req, res) { // unresolved function or method post()
      console.log("Message sent");
      var msg = req.body.message;
      if (msg != '') {
          messages.push(msg);
      }
      res.redirect('/');
  });
  </code></pre>
  
  <p>I am trying to send a request using the <code>POST</code> method but I keep getting "<strong>Unresolved function or method .post()</strong>".</p>
  
  <p>I tried to do the same as in the Express documentation : <a href="http://expressjs.com/api.html#router" rel="nofollow">Express Router</a></p>
  
  <p>I would appreciate any help.</p>