lib/application.js
function processControllerHandlers() {
  var self = this;
  var jsFile = this.regex.jsFile;
  var handlersPath = this.mvcpath + 'handlers';
  var relPath = self.relPath(this.mvcpath) + 'handlers';
  
  if (fs.existsSync(handlersPath)) {
    
    fs.readdirSync(handlersPath).forEach(function(dirname) {
      var dir = handlersPath + '/' + dirname;
      var stat = fs.statSync(dir);
      
      if (stat.isDirectory(dir)) {
        
        var handlers = self.handlers[dirname] = {};
        
        fileModule.walkSync(dir, function(dirPath, dirs, files) {
          for (var path,hkey,callback,file,i=0; i < files.length; i++) {
            file = files[i];
            path = dirPath + '/' + file;
            hkey = self.relPath(path, pathModule.basename(self.mvcpath) + '/handlers/' + dirname);
            if (jsFile.test(file)) {
              callback = protos.require(path, true); // Don't use module cache (allow reloading)
              if (callback instanceof Function) {
                handlers[hkey] = callback;
              } else {
                throw new Error(util.format("Expected a function for handler: %s/%s", dirname, file));
              }
            }
          }
        });
        
      }
      
    });
    
  }
  
  this.emit('handlers_loaded', self.handlers); // Emit regardless
  
}
function processControllerHandlers() {
  var self = this;
  var jsFile = this.regex.jsFile;
  var handlersPath = this.mvcpath + 'handlers';
  var relPath = self.relPath(this.mvcpath) + 'handlers';
  
  if (fs.existsSync(handlersPath)) {
    
    fs.readdirSync(handlersPath).forEach(function(dirname) {
      var dir = handlersPath + '/' + dirname;
      var stat = fs.statSync(dir);
      
      if (stat.isDirectory(dir)) {
        
        var handlers = self.handlers[dirname] = {};
        
        fileModule.walkSync(dir, function(dirPath, dirs, files) {
          for (var path,hkey,callback,file,i=0; i < files.length; i++) {
            file = files[i];
            path = dirPath + '/' + file;
            hkey = self.relPath(path, pathModule.basename(self.mvcpath) + '/handlers/' + dirname);
            if (jsFile.test(file)) {
              callback = protos.require(path, true); // Don't use module cache (allow reloading)
              if (callback instanceof Function) {
                handlers[hkey] = callback;
              } else {
                throw new Error(util.format("Expected a function for handler: %s/%s", dirname, file));
              }
            }
          }
        });
        
      }
      
    });
    
  }
  
  this.emit('handlers_loaded', self.handlers); // Emit regardless
  
}
function processControllerHandlers ( ) { var self = this ; var jsFile = this . regex . jsFile ; var handlersPath = this . mvcpath + 'handlers' ; var relPath = self . relPath ( this . mvcpath ) + 'handlers' ; if ( fs . existsSync ( handlersPath ) ) { fs . readdirSync ( handlersPath ) . forEach ( function ( dirname ) { var dir = handlersPath + '/' + dirname ; var stat = fs . statSync ( dir ) ; if ( stat . isDirectory ( dir ) ) { var handlers = self . handlers [ dirname ] = { } ; fileModule . walkSync ( dir , function ( dirPath , dirs , files ) { for ( var path , hkey , callback , file , i = 0 ; i < files . length ; i ++ ) { file = files [ i ] ; path = dirPath + '/' + file ; hkey = self . relPath ( path , pathModule . basename ( self . mvcpath ) + '/handlers/' + dirname ) ; if ( jsFile . test ( file ) ) { callback = protos . require ( path , true ) ; // Don't use module cache (allow reloading) if ( callback instanceof Function ) { handlers [ hkey ] = callback ; } else { throw new Error ( util . format ( "Expected a function for handler: %s/%s" , dirname , file ) ) ; } } } } ) ; } } ) ; } this . emit ( 'handlers_loaded' , self . handlers ) ; // Emit regardless }
Processes controller handlers
Processes controller handlers