Let's build the /transaction/:transactionId endpoint by using the getTransaction method that we built in the previous section. Let's begin:
- The first thing to do inside of this endpoint is to store the transaction ID sent as a request parameter. Let's store that in a transactionId variable, as follows:
app.get('/transaction/:transactionId', function(req, res) {
const transactionId = req.params.transactionId;
});
- The next thing to do is use the getTransaction method inside of the endpoint. To do this, add the following to the preceding code:
app.get('/transaction/:transactionId', function(req, res) {
const transactionId = req.params.transactionId;
bitcoin.getTransaction(transactionId);
});
- From the getTransaction method, we get an object returned to us that...