title: NodeJS - controller method not calling
body: <p>I created a NodeJS application with port 7777.</p>
  
  <p><code>server.js</code></p>
  
  <pre><code>'use strict';
  var express = require('express'),
      router = require('./router');
  var app = express();
  var port = 7777;
  app.use(router());
  app.listen(port);
  console.log('Doctor appointment at ' + port);
  </code></pre>
  
  <p>I am calling router from server and executng application as <code>node server.js</code></p>
  
  <p><code>router.js</code></p>
  
  <pre><code>'use strict';
  var express = require('express');
  var doctorAppointment = require('./controllers/doctorAppointment');
  module.exports = function() {
      var options = {
          caseSensitive: true
      };
      console.log("Router");
      // Instantiate an isolated express Router instance
      var router = express.Router(options);
      router.post('/appointment', doctorAppointment.takeAppoiment);
      return router;
  }
  </code></pre>
  
  <p>I am calling controller method from router. Controller follows:</p>
  
  <p><code>doctorAppointment.js</code></p>
  
  <pre><code>'use strict';
  
  exports.takeAppoiment = function(req, res, next) {
      console.log("Inside appointment");
  }
  </code></pre>
  
  <p>After execution, controller method is not calling   </p>
  
  <p><code>system@DT-LNX-315:~/Desktop/nodeJS/doctor-appointment$ node server.js</code><br>
  <code>Router</code><br>
  <code>Doctor appointment at 7777</code>  </p>
  
  <p>And end point defined in <a href="http://localhost:7777/" rel="nofollow">http://localhost:7777/</a></p>
  
  <p>coming as <code>Cannot GET /</code> in browser</p>
  
  <p>And for <a href="http://localhost:7777/appointment" rel="nofollow">http://localhost:7777/appointment</a></p>
  
  <p>showing as <code>Cannot GET /appointment</code>. How to execute controller method?</p>