docs: function FHapi(cfg) {
  
    var api = {
      getVersion: function() {
        //Getting The Version of fh-mbaas-api
        return packageJSON.version;
      },
      cache: require('./cache')(cfg),
      db: require('./db')(cfg),
      events: new EventEmitter(),
      forms: require('./forms')(cfg),
      log: false,
      stringify: false,
      parse: false,
      push: require('./push')(cfg),
      call: require('./call')(cfg),
      util: false,
      redisPort: cfg.redis.port || '6379',
      redisHost: cfg.redis.host || 'localhost',
      session: require('./session')(cfg),
      stats: require('./stats')(cfg),
      sync: sync,
      act: require('./act')(cfg),
      service: require('./act')(cfg),
      sec: sec.security,
      auth: require('./auth')(cfg),
      host: require('./host'),
      permission_map: require('fh-db').permission_map,
      hash: function(opts, callback) {
        var p = {
          act: 'hash',
          params: opts
        };
        sec.security(p, callback);
      },
      web: require('./web')(cfg)
    };
  
    api.sync.setEventEmitter(api.events);
  
    var redisUrl = 'redis://' + api.redisHost + ':' + api.redisPort;
  
    getDBUrl(api, function(err, connectionString) {
      if (err) {
        console.warn('Warning! Could not get a mongodb connection string. Sync will not work. (', err, ')');
        return;
      } else if (!connectionString) {
        console.warn('Warning! Could not get a mongodb connection string. Sync will not work. If running in a Dynofarm/FeedHenry MBaaS, ensure the database is upgraded');
        return;
      }
      var poolSize = parseInt(process.env.SYNC_MONGODB_POOLSIZE) || 50;
      api.sync.connect(connectionString, {poolSize: poolSize}, redisUrl, function(err) {
        if (err) {
          console.error('Error starting the sync server (', err, ')');
        }
      });
    });
  
    api.mbaasExpress = function(opts) {
      opts = opts || {};
      opts.api = api;
      return require('fh-mbaas-express')(opts);
    };
  
    api.shutdown = function(cb) {
      // Sync service has a setInterval loop running which will prevent fh-mbaas-api from exiting cleanly.
      // Call stopAll to ensure Sync exits clenaly.
      api.sync.stopAll(cb);
    };
  
    return api;
  }