title: Route.post() requires a callback function but got a [object Undefined] while compiling nodeJS
body: <p>I'm following a tutorial for API basics, whenever I run my project I get the error <code>Error: Route.post() requires a callback function but got a [object Undefined]</code>
  here is my routes file</p>
  
  <pre><code>module.exports = function (app) {
      var todoList = require('../controllers/todoListController');
      app.route('/tasks')
          .get(todoList.list_all_tasks)
          .post(todoList.create_a_task);
  
      app.route('/task/:taskId')
          .get(todoList.read_a_task)
          .put(todoList.update_a_task)
          .delete(todoList.delete_a_task);
  };
  </code></pre>
  
  <p>and here is my <code>server.js</code> file</p>
  
  <pre><code>var express = require('express'),
      app = express(),
      port = process.env.PORT || 3000,
      mongoose = require('mongoose'),
      Task = require('./api/models/todoListModel'), //created model loading here
      bodyParser = require('body-parser');
  
  // mongoose instance connection url connection
  mongoose.Promise = global.Promise;
  mongoose.connect('mongodb://localhost/Tododb');
  
  
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(bodyParser.json());
  
  
  var routes = require('./api/routes/todoListRoutes'); //importing route
  routes(app); //register the route
  
  
  app.listen(port);
  
  
  console.log('todo list RESTfaul API server started on: ' + port);
  </code></pre>
  
  <p>Even though I've tried passing a callback function to <code>post</code> method, but still it won't compile</p>