Merge pull request #362 from greggzigler/feat/get_version

clients want bws version for logging and debugging
This commit is contained in:
Ivan Socolsky 2015-09-18 14:33:26 -03:00
commit 88240dce1a
3 changed files with 9 additions and 0 deletions

View File

@ -415,6 +415,12 @@ ExpressApp.prototype.start = function(opts, cb) {
});
});
router.get('/v1/version/', function(req, res) {
var server = getServer(req, res);
res.json( { serviceVersion: server.serviceVersion } );
res.end();
});
this.app.use(opts.basePath || '/bws/api', router);
WalletService.initialize(opts, cb);

View File

@ -15,6 +15,7 @@ var Address = Bitcore.Address;
var ClientError = require('./errors/clienterror');
var Errors = require('./errors/errordefinitions');
var Package = require('../package');
var Utils = require('./utils');
var Lock = require('./lock');
@ -49,6 +50,7 @@ function WalletService() {
this.blockchainExplorerOpts = blockchainExplorerOpts;
this.messageBroker = messageBroker;
this.notifyTicker = 0;
this.serviceVersion = 'bws-' + Package.version;
};

View File

@ -756,6 +756,7 @@ describe('Wallet service', function() {
clientVersion: 'bwc-0.0.1',
});
server.clientVersion.should.equal('bwc-0.0.1');
server.serviceVersion.indexOf('bws-').should.equal(0);
});
});