api/server.js
// initializes the database with dummy data
initializes the database with dummy data
initializes the database with dummy data
function initializeDatabase() {
    console.log('initializing database');
    var dbfile = 'stats.db';
    stats = new Datastore({ filename: dbfile, autoload: true });
    fs.exists(dbfile, function(exists) {
        if (exists) { return; }
        console.log('loading dummy data');
        var dummies = test.generateDummyStats();
        _.each(dummies, function(dummy) {
            stats.insert(dummy);
        });
    });
}
function initializeDatabase ( ) { console . log ( 'initializing database' ) ; var dbfile = 'stats.db' ; stats = new Datastore ( { filename : dbfile , autoload : true } ) ; fs . exists ( dbfile , function ( exists ) { if ( exists ) { return ; } console . log ( 'loading dummy data' ) ; var dummies = test . generateDummyStats ( ) ; _ . each ( dummies , function ( dummy ) { stats . insert ( dummy ) ; } ) ; } ) ; }
initializes the database with dummy data
initializes the database with dummy data
// load dummy data once