add REST endpoint
This commit is contained in:
parent
8df8327395
commit
da6e61b7e7
|
@ -57,7 +57,7 @@ ExpressApp.prototype.start = function(opts, cb) {
|
|||
|
||||
|
||||
// handle `abort` https://nodejs.org/api/http.html#http_event_abort
|
||||
this.app.use(function (req, res, next) {
|
||||
this.app.use(function(req, res, next) {
|
||||
req.on('abort', function() {
|
||||
log.warn('Request aborted by the client');
|
||||
});
|
||||
|
@ -711,6 +711,28 @@ ExpressApp.prototype.start = function(opts, cb) {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
router.post('/v1/txconfirmations/', function(req, res) {
|
||||
getServerWithAuth(req, res, function(server) {
|
||||
server.txConfirmationSubscribe(req.body, function(err, response) {
|
||||
if (err) return returnError(err, res, req);
|
||||
res.json(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
router.delete('/v1/txconfirmations/:txid', function(req, res) {
|
||||
var opts = {
|
||||
txid: req.params['txid'],
|
||||
};
|
||||
getServerWithAuth(req, res, function(server) {
|
||||
server.txConfirmationUnsubscribe(opts, function(err, response) {
|
||||
if (err) return returnError(err, res, req);
|
||||
res.json(response);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.app.use(opts.basePath || '/bws/api', router);
|
||||
|
||||
WalletService.initialize(opts, cb);
|
||||
|
|
Loading…
Reference in New Issue