app.js
function(io) {
      // chat routes
      router.use('/chat', chatRoutes);

      // ops routes
      router.use('/ops', opsRoutes);

      // ShareJS built-in REST routes
      router.use('/docs', shareRoutes);

      if(io) {
        io.of('/chat').on('connection', chatHandler);
      }

      router.use('/lib', express.static(path.join(__dirname, '/node_modules')));
      router.use(express.static(path.join(__dirname, '/public')));

      return router;
    }
function(io) {
      // chat routes
      router.use('/chat', chatRoutes);

      // ops routes
      router.use('/ops', opsRoutes);

      // ShareJS built-in REST routes
      router.use('/docs', shareRoutes);

      if(io) {
        io.of('/chat').on('connection', chatHandler);
      }

      router.use('/lib', express.static(path.join(__dirname, '/node_modules')));
      router.use(express.static(path.join(__dirname, '/public')));

      return router;
    }
function ( io ) { // chat routes router . use ( '/chat' , chatRoutes ) ; // ops routes router . use ( '/ops' , opsRoutes ) ; // ShareJS built-in REST routes router . use ( '/docs' , shareRoutes ) ; if ( io ) { io . of ( '/chat' ) . on ( 'connection' , chatHandler ) ; } router . use ( '/lib' , express . static ( path . join ( __dirname , '/node_modules' ) ) ) ; router . use ( express . static ( path . join ( __dirname , '/public' ) ) ) ; return router ; }
This function creates and returns an Express 4 Router.

As a side effect, creates the necessary socket channels using the given
socketIO object.

Example usage:

var express = require('express'),
app = express(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);

var jibe = require('jibe');
app.use(jibe(io).router);
app.use(jibe.browserChannelMiddleware);
This function creates and returns an Express 4 Router .