Added ability to configure HTTP route prefixes.

This commit is contained in:
Braydon Fuller 2015-10-13 10:52:02 -04:00
parent 7bc78928b1
commit db2ee2ab27

View File

@ -10,6 +10,7 @@ var MessagesController = require('./messages');
var UtilsController = require('./utils');
var CurrencyController = require('./currency');
var bitcore = require('bitcore');
var _ = bitcore.deps._;
var $ = bitcore.util.preconditions;
var Transaction = bitcore.Transaction;
var EventEmitter = require('events').EventEmitter;
@ -24,6 +25,8 @@ var InsightAPI = function(options) {
inv: []
};
this.routePrefix = options.routePrefix;
this.txController = new TxController(this.node);
};
@ -31,6 +34,14 @@ InsightAPI.dependencies = ['address', 'web'];
inherits(InsightAPI, BaseService);
InsightAPI.prototype.getRoutePrefix = function() {
if (!_.isUndefined(this.routePrefix)) {
return this.routePrefix;
} else {
return this.name;
}
};
InsightAPI.prototype.start = function(callback) {
this.node.services.bitcoind.on('tx', this.transactionHandler.bind(this));