January 2020
Intermediate to advanced
530 pages
11h 11m
English
The endpoint /gettrans returns the incoming and outgoing transactions against an account when called from the bank portal frontend. It fetches the transactions from the transactions relation in the bank database, by running a SELECT query against it.
We start by fetching the customer's account from the request body, as follows:
app.post('/gettrans', function (request, response) {const account = request.body.account;
Next, we fetch all the transactions from the transactions relation for the account in the request body, as follows:
client.query('SELECT * FROM transactions WHERE saccount = $1 OR raccount = $1', [account], (error, results)=> {
On the response from the pg client, we check for an error ...
Read now
Unlock full access