lib/application.js
function loadControllers() {
  
  // Note: runs on app context
  
  // Get controllers/
  var cpath = this.mvcpath + 'controllers/',
      files = protos.util.getFiles(cpath);

  // Create controllers and attach to app
  var controllerCtor = protos.lib.controller;
  for (var controller, key, file, instance, className, Ctor, i=0; i < files.length; i++) {
    file = files[i];
    key = file.replace(this.regex.jsFile, '');
    className = file.replace(this.regex.jsFile, '');
    Ctor = protos.require(cpath + className, true); // Don't use module cache (allow reloading)
    Ctor = createControllerFunction.call(this, Ctor);
    instance = new Ctor(this);
    instance.className = instance.constructor.name;
    this.controllers[key.replace(/_controller$/, '')] = instance;
  }

  this.controller = this.controllers.main;
  
  this.emit('controllers_loaded', this.controllers);

}
function loadControllers() {
  
  // Note: runs on app context
  
  // Get controllers/
  var cpath = this.mvcpath + 'controllers/',
      files = protos.util.getFiles(cpath);

  // Create controllers and attach to app
  var controllerCtor = protos.lib.controller;
  for (var controller, key, file, instance, className, Ctor, i=0; i < files.length; i++) {
    file = files[i];
    key = file.replace(this.regex.jsFile, '');
    className = file.replace(this.regex.jsFile, '');
    Ctor = protos.require(cpath + className, true); // Don't use module cache (allow reloading)
    Ctor = createControllerFunction.call(this, Ctor);
    instance = new Ctor(this);
    instance.className = instance.constructor.name;
    this.controllers[key.replace(/_controller$/, '')] = instance;
  }

  this.controller = this.controllers.main;
  
  this.emit('controllers_loaded', this.controllers);

}
function loadControllers ( ) { // Note: runs on app context // Get controllers/ var cpath = this . mvcpath + 'controllers/' , files = protos . util . getFiles ( cpath ) ; // Create controllers and attach to app var controllerCtor = protos . lib . controller ; for ( var controller , key , file , instance , className , Ctor , i = 0 ; i < files . length ; i ++ ) { file = files [ i ] ; key = file . replace ( this . regex . jsFile , '' ) ; className = file . replace ( this . regex . jsFile , '' ) ; Ctor = protos . require ( cpath + className , true ) ; // Don't use module cache (allow reloading) Ctor = createControllerFunction . call ( this , Ctor ) ; instance = new Ctor ( this ) ; instance . className = instance . constructor . name ; this . controllers [ key . replace ( / _controller$ / , '' ) ] = instance ; } this . controller = this . controllers . main ; this . emit ( 'controllers_loaded' , this . controllers ) ; }
Loads controllers & routes
Loads controllers & routes