{"size": 758, "ext": "js", "max_stars_repo_path": "server/services/factory.js", "max_stars_repo_name": "TradaTech/couple-lock", "max_stars_repo_stars_event_min_datetime": "2019-04-23T11:52:58.000Z", "max_stars_repo_stars_event_max_datetime": "2019-04-23T11:52:58.000Z", "max_issues_repo_path": "server/services/factory.js", "max_issues_repo_name": "TradaTech/couple-lock", "max_issues_repo_issues_event_min_datetime": "2019-01-18T09:10:19.000Z", "max_issues_repo_issues_event_max_datetime": "2019-01-18T11:20:01.000Z", "max_forks_repo_path": "server/services/factory.js", "max_forks_repo_name": "TradaTech/couple-lock", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 24.4516129032, "max_line_length": 53, "alphanum_fraction": 0.5712401055}
const _ = require('lodash');
const config = require('../config').get();
const Store = require('./' + config.datastore);

const stores = {};

module.exports = {
    getStore: (namespace) => {
        if (!stores[namespace]) {
            stores[namespace] = new Store(namespace);
        }
        return stores[namespace];
    }
}

console.log('CONFIG', config);

// Seed some data for testing
if (config.seed) {
    const seeder = require('./seed');
    const f = module.exports;
    _.each(seeder, (value, namespace) => {
        const store = f.getStore(namespace);
        _.each(value, item => {
            const key = item.username || item.id;
            store.tryInsert(key, item);
        });
    })
}

console.log('API http://localhost:5000/api');