db connection moved to index.js to be a little more explicit. Cleaned up some comments and console logs

This commit is contained in:
tenthirtyone 2017-08-03 21:45:35 -04:00
parent 43b23b80dc
commit a5528e49d8
3 changed files with 3 additions and 12 deletions

View File

@ -2,10 +2,13 @@ const node = require('./lib/node');
const config = require('./config/config');
const logger = require('./lib/logger');
const Api = require('./lib/api');
const db = require('./lib/db');
logger.log('debug',
'Debug mode started');
db.connect(config.mongodb.uri, config.mongodb.options);
Api.listen(config.api.port, () => {
logger.log('debug',
'listening on port 3000');

View File

@ -1,6 +1,3 @@
const mongoose = require('mongoose');
const config = require('../../config/config');
mongoose.connect(config.mongodb.uri, config.mongodb.options);
module.exports = mongoose;

View File

@ -2,7 +2,6 @@ const FullNode = require('bcoin/lib/node/fullnode');
const config = require('../../config/config');
const node = new FullNode(config.bcoin);
const logger = require('../../lib/logger');
const db = require('../../lib/db');
const util = require('../../lib/util');
const BlockModel = require('../../models/block');
const TxModel = require('../../models/transaction').Transaction;
@ -97,20 +96,12 @@ function processTx(entry, txs) {
fees: tx.fee,
chain: config.bcoin.network,
});
console.log(txHash);
t.save((err) => {
if (err) {
console.log(err.message);
}
});
});
// console.log(util.revHex(tx.hash().toString('hex')));
// tx.hash = util.revHex(tx.hash().toString('hex'));
// entry.hash = util.revHex(entry.hash().toString('hex'));
/*
*/
}
module.exports = {