diff --git a/lib/expressapp.js b/lib/expressapp.js index 3b7e08c..0a1afec 100644 --- a/lib/expressapp.js +++ b/lib/expressapp.js @@ -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); diff --git a/lib/server.js b/lib/server.js index 577ae30..683069b 100644 --- a/lib/server.js +++ b/lib/server.js @@ -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; }; diff --git a/test/integration/server.js b/test/integration/server.js index c4872bd..c84d4c8 100644 --- a/test/integration/server.js +++ b/test/integration/server.js @@ -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); }); });