To create the backend server for Bank B, duplicate the backend server code for Bank A, and change the following details:
- The ipfs object to the client port for Bank B, as follows:
const ipfs = ipfsClient('http://localhost:5002')
- postgres client values to the following code:
const conString = "postgres://bankb:bankb@localhost:5432/bankb";
- The server port to the following, to avoid conflict:
var server = app.listen(process.env.PORT || 8001, function () {
var port = server.address().port;
console.log("App now running on port", port);
});
- The ccpPath object to the connection profile for bankb, as follows:
const ccpPath = '~/fabric-samples/bankchain/connection-bankb.json';
- The wallet path for BankB, as follows:
const wallet = new FileSystemWallet('~/fabric-samples/bankchain/wallet-BankB');
- Bring both the servers online by running the following commands on separate Terminals:
$node backend-BankA.js
$node backend-BankB.js
You should now have the backend servers online at the 8000 and 8001 ports, for Bank A and Bank B respectively.