title: Nodejs include socket.io in router page
body: <p>I have an express node app, and I'm trying to keep my code neat by not having all the socket.io stuff in app.js</p>
  
  <p>I don't know the best way to go about this. Here is my initial thought which doesn't feel like the cleanest one</p>
  
  <pre><code>// app.js
  var express = require('express')
      , app = express()
      , server = require('http').createServer(app)
      , url = require('url')
      , somePage = require('./routes/somePage.js')
      , path = require('path');
  
      app.configure(function(){...});
  
      app.get('/', somePage.index);
  </code></pre>
  
  <p>and the route</p>
  
  <pre><code>// somePage.js
      exports.index = function (req, res, server) {
          io = require('socket.io').listern(server)
          res.render('index',{title: 'Chat Room'})
  
          io.sockets.on('connection', function(socket) {
              ...code...
          }
      }
  </code></pre>
  
  <p>I feel like I'm close but not quite there</p>