index.js
function (baseUrl, firebaseUrl, port, cardsDirectory) {
    // Set environment variables.
    process.env.BASE_URL = baseUrl || '';
    process.env.FIREBASE_URL = firebaseUrl || 'https://hashdodemo.firebaseio.com/',
    process.env.CARDS_DIRECTORY = cardsDirectory || process.cwd();
    process.env.PORT = port || 4000;
    
    var Path = require('path'),
      Favicon = require('serve-favicon'),
      Hpp = require('hpp');

    App.use(Timeout('10s'));
    App.use(Favicon(Path.join(__dirname, '/public/favicon.ico')));
    App.use(Express.static('public'));
    // Hacky, quick fix required for now.
    // **********************************
    App.use('/js', Express.static(Path.join(__dirname, '/node_modules/hashdo/public/js')));
    App.use('/css', Express.static(Path.join(__dirname, '/node_modules/hashdo/public/css')));
    // **********************************
    App.use(BodyParser.urlencoded({extended: false, limit: '5mb'}));
    App.use(Hpp());
    App.use(Cors());
    App.use(haltOnTimedout);

    function haltOnTimedout(req, res, next){
      if (!req.timedout) next();
    }
    
    // Assume cards directory is based off root if a full path is not provided.
    if (!Path.isAbsolute(process.env.CARDS_DIRECTORY)) {
      process.env.CARDS_DIRECTORY = Path.join(process.cwd(), process.env.CARDS_DIRECTORY);
    }
    
    HashDo.packs.init(baseUrl, process.env.CARDS_DIRECTORY);

    // Make public card directories static
    HashDo.packs.cards().forEach(function (card) {
      var packDirectory = Path.join(cardsDirectory, 'hashdo-' + card.pack);  
      App.use('/' + card.pack + '/' + card.card, Express.static(Path.join(packDirectory, 'public', card.card)));
    });
  }
function (baseUrl, firebaseUrl, port, cardsDirectory) {
    // Set environment variables.
    process.env.BASE_URL = baseUrl || '';
    process.env.FIREBASE_URL = firebaseUrl || 'https://hashdodemo.firebaseio.com/',
    process.env.CARDS_DIRECTORY = cardsDirectory || process.cwd();
    process.env.PORT = port || 4000;
    
    var Path = require('path'),
      Favicon = require('serve-favicon'),
      Hpp = require('hpp');

    App.use(Timeout('10s'));
    App.use(Favicon(Path.join(__dirname, '/public/favicon.ico')));
    App.use(Express.static('public'));
    // Hacky, quick fix required for now.
    // **********************************
    App.use('/js', Express.static(Path.join(__dirname, '/node_modules/hashdo/public/js')));
    App.use('/css', Express.static(Path.join(__dirname, '/node_modules/hashdo/public/css')));
    // **********************************
    App.use(BodyParser.urlencoded({extended: false, limit: '5mb'}));
    App.use(Hpp());
    App.use(Cors());
    App.use(haltOnTimedout);

    function haltOnTimedout(req, res, next){
      if (!req.timedout) next();
    }
    
    // Assume cards directory is based off root if a full path is not provided.
    if (!Path.isAbsolute(process.env.CARDS_DIRECTORY)) {
      process.env.CARDS_DIRECTORY = Path.join(process.cwd(), process.env.CARDS_DIRECTORY);
    }
    
    HashDo.packs.init(baseUrl, process.env.CARDS_DIRECTORY);

    // Make public card directories static
    HashDo.packs.cards().forEach(function (card) {
      var packDirectory = Path.join(cardsDirectory, 'hashdo-' + card.pack);  
      App.use('/' + card.pack + '/' + card.card, Express.static(Path.join(packDirectory, 'public', card.card)));
    });
  }
function ( baseUrl , firebaseUrl , port , cardsDirectory ) { // Set environment variables. process . env . BASE_URL = baseUrl || '' ; process . env . FIREBASE_URL = firebaseUrl || 'https://hashdodemo.firebaseio.com/' , process . env . CARDS_DIRECTORY = cardsDirectory || process . cwd ( ) ; process . env . PORT = port || 4000 ; var Path = require ( 'path' ) , Favicon = require ( 'serve-favicon' ) , Hpp = require ( 'hpp' ) ; App . use ( Timeout ( '10s' ) ) ; App . use ( Favicon ( Path . join ( __dirname , '/public/favicon.ico' ) ) ) ; App . use ( Express . static ( 'public' ) ) ; // Hacky, quick fix required for now. // ********************************** App . use ( '/js' , Express . static ( Path . join ( __dirname , '/node_modules/hashdo/public/js' ) ) ) ; App . use ( '/css' , Express . static ( Path . join ( __dirname , '/node_modules/hashdo/public/css' ) ) ) ; // ********************************** App . use ( BodyParser . urlencoded ( { extended : false , limit : '5mb' } ) ) ; App . use ( Hpp ( ) ) ; App . use ( Cors ( ) ) ; App . use ( haltOnTimedout ) ; function haltOnTimedout ( req , res , next ) { if ( ! req . timedout ) next ( ) ; } // Assume cards directory is based off root if a full path is not provided. if ( ! Path . isAbsolute ( process . env . CARDS_DIRECTORY ) ) { process . env . CARDS_DIRECTORY = Path . join ( process . cwd ( ) , process . env . CARDS_DIRECTORY ) ; } HashDo . packs . init ( baseUrl , process . env . CARDS_DIRECTORY ) ; // Make public card directories static HashDo . packs . cards ( ) . forEach ( function ( card ) { var packDirectory = Path . join ( cardsDirectory , 'hashdo-' + card . pack ) ; App . use ( '/' + card . pack + '/' + card . card , Express . static ( Path . join ( packDirectory , 'public' , card . card ) ) ) ; } ) ; }
Configured process events and middleware required to run the web application.
This function should always be called before starting the web server.

@method init

@param {String}   baseUrl           The URL that the web application will be accessible from.
@param {String}   [firebaseUrl]     Optional Firebase URL for real-time client updates. If not provided 'https://hashdodemo.firebaseio.com/' will be used.
@param {Number}   [port]            Optional port the web server will listen on. If not provided 4000 will be used.
@params {String}  [cardsDirectory]  Optional cards directory where your #Do cards will be loaded from. If not provided then cards will be searched for in the current working directory.
Configured process events and middleware required to run the web application . This function should always be called before starting the web server .