Merge pull request #403 from braydonf/feature/configurable-routes

Added ability to configure HTTP route prefixes.
This commit is contained in:
Patrick Nagurny 2015-10-13 11:20:06 -04:00
commit de6a44d14e

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,12 @@ var InsightAPI = function(options) {
inv: []
};
if (!_.isUndefined(options.routePrefix)) {
this.routePrefix = options.routePrefix;
} else {
this.routePrefix = this.name;
}
this.txController = new TxController(this.node);
};
@ -31,6 +38,10 @@ InsightAPI.dependencies = ['address', 'web'];
inherits(InsightAPI, BaseService);
InsightAPI.prototype.getRoutePrefix = function() {
return this.routePrefix;
};
InsightAPI.prototype.start = function(callback) {
this.node.services.bitcoind.on('tx', this.transactionHandler.bind(this));