lib/js/Server.js
function(request, response, next) {
      var t = this,
          url = request.url,
          searchStart = url.indexOf('?'),
          templates = t.get('templates');

      // Remove any URL params
      if (searchStart > 0) {
        url = url.substr(0, searchStart);
      }

      // Get the page model
      t._getPage(url, function(error, pageModel) {

        if (error) {
          return response.end('page error: ' + JSON.stringify(error));
        }

        // Build the object to put into the page template
        var page = _.extend({templates:''}, PAGE_PARAMS, t.site.toJSON(), pageModel.toJSON());
        page.pageParams = Template.indent(JSON.stringify(pageModel.toJSON({deep:true,trim:true}), null, 2), 8);

        // Add all watched templates except the main page
        templates.each(function(template) {
          if (template.id !== 'UI') {
            page.templates += TMPL_TEMPLATE({
              id:template.id,
              text:Template.indent(template.get('text'),8)
            });
          }
        });

        // Output the page
        response.writeHead(200, {'Content-Type': 'text/html'});
        var pageTemplate = templates.get('UI');
        return response.end(pageTemplate.apply(page));
      });
    }
function(request, response, next) {
      var t = this,
          url = request.url,
          searchStart = url.indexOf('?'),
          templates = t.get('templates');

      // Remove any URL params
      if (searchStart > 0) {
        url = url.substr(0, searchStart);
      }

      // Get the page model
      t._getPage(url, function(error, pageModel) {

        if (error) {
          return response.end('page error: ' + JSON.stringify(error));
        }

        // Build the object to put into the page template
        var page = _.extend({templates:''}, PAGE_PARAMS, t.site.toJSON(), pageModel.toJSON());
        page.pageParams = Template.indent(JSON.stringify(pageModel.toJSON({deep:true,trim:true}), null, 2), 8);

        // Add all watched templates except the main page
        templates.each(function(template) {
          if (template.id !== 'UI') {
            page.templates += TMPL_TEMPLATE({
              id:template.id,
              text:Template.indent(template.get('text'),8)
            });
          }
        });

        // Output the page
        response.writeHead(200, {'Content-Type': 'text/html'});
        var pageTemplate = templates.get('UI');
        return response.end(pageTemplate.apply(page));
      });
    }
function ( request , response , next ) { var t = this , url = request . url , searchStart = url . indexOf ( '?' ) , templates = t . get ( 'templates' ) ; // Remove any URL params if ( searchStart > 0 ) { url = url . substr ( 0 , searchStart ) ; } // Get the page model t . _getPage ( url , function ( error , pageModel ) { if ( error ) { return response . end ( 'page error: ' + JSON . stringify ( error ) ) ; } // Build the object to put into the page template var page = _ . extend ( { templates : '' } , PAGE_PARAMS , t . site . toJSON ( ) , pageModel . toJSON ( ) ) ; page . pageParams = Template . indent ( JSON . stringify ( pageModel . toJSON ( { deep : true , trim : true } ) , null , 2 ) , 8 ) ; // Add all watched templates except the main page templates . each ( function ( template ) { if ( template . id !== 'UI' ) { page . templates += TMPL_TEMPLATE ( { id : template . id , text : Template . indent ( template . get ( 'text' ) , 8 ) } ) ; } } ) ; // Output the page response . writeHead ( 200 , { 'Content-Type' : 'text/html' } ) ; var pageTemplate = templates . get ( 'UI' ) ; return response . end ( pageTemplate . apply ( page ) ) ; } ) ; }
Route to a monitor page.

@protected
@method _monitorPageRoute
@param request {Connect.Request} The http request object
@param response {Connect.Response} The http response object
@param next {Function()} Function to pass control if this doesn't handle the url.
Route to a monitor page .