title: Expressjs 405 POST method not allowed
body: <p>Route perfectly works well from POSTMAN chrome extension, with Angular it doesn't. </p>
  
  <p>Well here goes my <strong>Express js code</strong> : </p>
  
  <pre><code>var express = require('express');
  var router = express.Router();
  var app = express();
  var bodyParser = require('body-parser')
  var routes = require('./routes');
  var connection  = require('express-myconnection');
  
  app.use(bodyParser.json()); // for parsing application/json
  app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
  
  /** Serve our app on root path */
  app.use('/', express.static('app'));
  
  /** Login API */
  app.post('/login', routes.login);
  </code></pre>
  
  <p>And here goes <strong>Angular code</strong>:</p>
  
  <pre><code>$http({
      method: 'POST',
      url: apiUrl + 'login',
      headers: {
          'Content-Type': 'application/x-www-form-urlencoded' // necessary for expressjs
      },
      transformRequest: function(obj) {
          var str = [];
          for (var p in obj) {
              str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
          }
          return str.join("&amp;");
      },
      data: user
  });
  </code></pre>
  
  <p>Not sure whats wrong! This is what I get : </p>
  
  <p><img src="https://i.stack.imgur.com/PFbLe.png" alt="enter image description here"></p>