Hyperledger Composer Rest Server connection with C

2019-08-03 06:37发布

问题:

i'm trying to set up the Hyperledger Composer Rest Server (https://hyperledger.github.io/composer/reference/rest-server) in order to work with Cloudant DB on IBM Cloud and store inside it the cards used to interact with the blockchain.

In particular i would like to know how to configure the COMPOSER_DATASOURCES parameter of composer-rest-server.

Thanks in advance for your availability.
Best Regards

回答1:

The Composer Rest Server uses loopback, and so the COMPOSER_DATASOURCES are lookback datasources. In order to use cloudant you would need to use npm to install loopback-conector-cloudant, and then set the data source to be something like:

"mydb": {
  "name": "mydb",
  "connector": "cloudant",
  "username": "XXXX-bluemix",
  "password": "YYYYYYYYYYYY",
  "database": "test"
}

There is good detailed documentation here from loopback.