title: NodeJS : TypeError: res.redirect is not a function
body: <p>I am learning NodeJS, and was following a tutorial to build a todo list for myself, in process i was able to render a page, but when i tried to redirect after adding some entries, it throws res.redirect is not a function error, and i cant find a simple solution to fix it. I am pasting complete code here (LINE #73, fifth line from end throws error)</p>
  
  <pre><code>var express = require('express');
  var bodyParser = require('body-parser');
  var path = require('path');
  var expressValidator = require('express-validator')
  var app = express();
  var mongojs = require('mongojs');
  var db = mongojs('mytodolist', ['items'])
  
  // set up the logger
  var logger = function(req,res,next){
    console.log('its the logger ....');
    next();
  }
  app.use(logger);
  
  // set up view engine
  app.set('view engine', 'ejs');
  app.set('views',path.join(__dirname, 'views'));
  
  // Body Parser Middleware
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({extended: false}));
  
  /* used items until hooked mongo db instance
  var items = [
    {
      id: 1,
      task_desc: 'task one',
      priority: 'P1',
      ETA: 'Jan 31',
    },
    {
      id: 2,
      task_desc: 'task two',
      priority: 'P2',
      ETA: 'Feb 06',
    },
    {
      id: 1,
      task_desc: 'task three',
      priority: 'P3',
      ETA: 'March 1',
    },
  ]
  */
  
  app.get('/', function(req, res){
    //res.send('Hello World again');
    // find everything
    db.items.find(function (err, docs) {
      // docs is an array of all the documents in mycollection
      //console.log(docs);
      res.render('index',{
        title: 'My To Do List',
        //items: items - "until mongo was hooked up"
        items: docs
      });
    })
  
  });
  //add express validator
  app.post('/items/add', function(req,res){
    var newItem = {
      task_desc: req.body.task_desc,
      priority: req.body.priority,
      ETA: req.body.ETA
    }
    //console.log(newItem);
    db.items.insert(newItem, function(err, res){
      if(err){
        console.log(err);
      }
      return res.redirect('/');  // THIS LINE BREAKS
    });
  });
  app.listen(3000, function(){
    console.log('server started on port 3000...')
  })
  </code></pre>
  
  <p>Node Experts: Your help is very much appreciated. Thanks a ton in advance. :) </p>