Added ability to configure HTTP route prefixes.
This commit is contained in:
parent
7bc78928b1
commit
db2ee2ab27
11
lib/index.js
11
lib/index.js
@ -10,6 +10,7 @@ var MessagesController = require('./messages');
|
|||||||
var UtilsController = require('./utils');
|
var UtilsController = require('./utils');
|
||||||
var CurrencyController = require('./currency');
|
var CurrencyController = require('./currency');
|
||||||
var bitcore = require('bitcore');
|
var bitcore = require('bitcore');
|
||||||
|
var _ = bitcore.deps._;
|
||||||
var $ = bitcore.util.preconditions;
|
var $ = bitcore.util.preconditions;
|
||||||
var Transaction = bitcore.Transaction;
|
var Transaction = bitcore.Transaction;
|
||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
@ -24,6 +25,8 @@ var InsightAPI = function(options) {
|
|||||||
inv: []
|
inv: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.routePrefix = options.routePrefix;
|
||||||
|
|
||||||
this.txController = new TxController(this.node);
|
this.txController = new TxController(this.node);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -31,6 +34,14 @@ InsightAPI.dependencies = ['address', 'web'];
|
|||||||
|
|
||||||
inherits(InsightAPI, BaseService);
|
inherits(InsightAPI, BaseService);
|
||||||
|
|
||||||
|
InsightAPI.prototype.getRoutePrefix = function() {
|
||||||
|
if (!_.isUndefined(this.routePrefix)) {
|
||||||
|
return this.routePrefix;
|
||||||
|
} else {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
InsightAPI.prototype.start = function(callback) {
|
InsightAPI.prototype.start = function(callback) {
|
||||||
this.node.services.bitcoind.on('tx', this.transactionHandler.bind(this));
|
this.node.services.bitcoind.on('tx', this.transactionHandler.bind(this));
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user