code: function _preHandlers() {
    var session;
    // enable db connection
    if(config.db.enabled) {
      var db = require('./db');
      db.init(config.db);
      logger.info(pkgname + "  mongodb initialized at:"+config.db.url);
  
      // export crudHelper
      exports.crudHelpers = require('mongoose-plugins').crudHelpers;
      exports.installUserSchema = require('mongoose-plugins').installUserSchema;
  
      // enable db sessions
      var oneWeek = 657450000;
      session = express.session({
        key    : config.app.key,
        store  : new Session({url: config.db.url }), 
        cookie : { maxAge: config.app.cookieAge||oneWeek }, 
        secret : config.app.secret
      });
      logger.info(pkgname + "  persistent sessions enabled");
    } else {
      session = express.session({
          key    : config.app.key,
          secret : config.app.secret
        });
      logger.info(pkgname + "  in-memory sessions enabled");
    }
    app.use(session);
  
  }
docs: ----------------------------------------------- internal functions register all pre handlers here