title: TypeError: Object #<IncomingMessage> has no method 'render'
body: <p>I am developing a simple application with node.js and express, almost all is ok, but I get this error:</p>
  
  <pre><code>res.render("aggregatedCostList",{
        ^
  TypeError: Object #&lt;IncomingMessage&gt; has no method 'render'
  at /home/arpho/Projects/myBalance/routes/index.js:90:11
  at /home/arpho/Projects/myBalance/node_modules/async/lib/async.js:116:25
  at /home/arpho/Projects/myBalance/node_modules/async/lib/async.js:24:16
  at /home/arpho/Projects/myBalance/routes/index.js:87:7
  at /home/arpho/Projects/myBalance/node_modules/orientdb/lib/orientdb/db.js:539:24
  at toRidsFromORIDsOfDocument (/home/arpho/Projects/myBalance/node_modules/orientdb/lib/orientdb/db.js:507:16)
  at toRidsFromORIDsOfDocuments (/home/arpho/Projects/myBalance/node_modules/orientdb/lib/orientdb/db.js:534:9)
  at Object.callback (/home/arpho/Projects/myBalance/node_modules/orientdb/lib/orientdb/db.js:302:9)
  at EventEmitter.Manager.readResponse (/home/arpho/Projects/myBalance/node_modules/orientdb/lib/orientdb/connection/manager.js:218:21)
  at Socket.&lt;anonymous&gt; (/home/arpho/Projects/myBalance/node_modules/orientdb/lib/orientdb/connection/manager.js:167:14)
  </code></pre>
  
  <p>when I try to access list_purchase after submitting  a form, it happens  both in post and  in get.</p>
  
  <p>this isan extract of my <strong>app.js</strong>:</p>
  
  <pre><code>      app.set('port', process.env.PORT || 3000);
    app.set('views', __dirname + '/views');
    app.set('view engine', 'jade');
    app.use(express.favicon());
    app.use(express.logger('dev'));
    app.use(express.bodyParser());
    app.use(express.methodOverride());
    app.use(express.cookieParser('your secret here'));
    app.use(express.session());
    app.use(app.router);
    app.use(express.static(path.join(__dirname, 'public')));
    //app.get('/new_post', routes.new_post_form);
    //app.post('/new_post', routes.new_post);
    app.get('/list_purchase',routes.list_purchase)
    app.post('/list_purchase',routes.filtered_list_purchase)
  </code></pre>
  
  <p>this is an extract of my <strong>index.js</strong>:</p>
  
  <pre><code>  exports.filtered_list_purchase = function(res,req){
    debug('filtering')
    debug(req.req.body)
    range = req.req.body.range
    aggr = req.req.body.aggr
    var intervals = Aggregation.makeIntervals(Aggregation,range,aggr)
    debug(intervals)
    for(var i =0;i&lt;intervals.length;i++){
      debug('dentro il for')
      debug(intervals[i])
      //aggiungo agli items di intervals il campo query
      var item = intervals[i]
      var where = Aggregation.makeClausolaWhere(Aggregation,item)
      intervals[i].query = "select sum(price) as sum from purchase "+where
      intervals[i].inizio = Aggregation.getDate(Aggregation,intervals[i].inizio)
      intervals[i].fine = Aggregation.getDate(Aggregation,intervals[i].fine)
      }
    debug(intervals)
    var count = 0
    function iterator(item,next){module.db.command(item.query,function(e,o){if(e) {return console.dir(e)}
      delete item.query //cancello il campo per  risparmiare banda
      count += 1
      if (o.length&gt;0){item.subTotal = o[0].sum}else{item.subTotal = 0}
      next(e,o)})
    }
    async.each(intervals,iterator,function(err){if(err){return console.dir(err)}
      res.render("aggregatedCostList",{
        aggregation:Aggregation.aggregation.name[aggr],
        data:intervals
      })
    })
  }
  </code></pre>
  
  <p>the templates that define my form:</p>
  
  <p><strong>costList.jade</strong></p>
  
  <p>extends aggregation
    block content
      table
        thead
          th
            b Acquisto
          th
            b Prezzo
          th
            b Nota
           th
             b Data
           - each a in locals.purchases</p>
  
  <pre><code>       tr
           th
             a(href="/purchase/"+a['@rid']) 
               p  #{a.purchase}
           th
             p #{a.price}
           th
             p #{a.nota}
           th
             p #{a.data}
  p -----------------------------------------------------------------------------------------------------------
   p  Totale: #{locals.totale} 
  a(href="/new_purchase") aggiungi acquisto
  </code></pre>
  
  <p><strong>aggregation.jade:</strong></p>
  
  <pre><code>extends layout 
  block aggregation
    form(action=locals.next,method="post")
      p
      label lasso temporale
      input(name="range",type="text")
      p 
        label aggregazione
              select(name='aggr')
                option(value='d') day
                option(value='w') week
                option(value='m') month
                option(value='y') year
    input(type="submit",value='aggrega')
  </code></pre>
  
  <p>to me appear right , I can not find the mistake that surely is in my code</p>