title: How is req and res accessible accross modules in Express.js
body: <p>While using express.js for handling various routes I want to encapsulate all of my route code in a seperate module, but how can I access the req and res object across modules, See the code below
  The main file examples.js is written as follows</p>
  
  <pre><code>var app = require('express').createServer();
  var login = require('./login.js');
  app.get('/login', login.auth(app.req, app.res));
  app.listen(80);
  </code></pre>
  
  <p>What I want is that the login handling code be written in a seperate module/file called login.js, the question then is how will the response object be accessible in login.js. I think the following code will not work as because the type of req and res is not resolved.</p>
  
  <pre><code>exports.auth = function(req, res) {
      res.send('Testing');
  }
  </code></pre>
  
  <p>Hence when I start the server with node example.js I get the error</p>
  
  <p>'Cannot call method send of undefined'</p>
  
  <p>How is the Request and REsponse objects passed along modules</p>