I have a query file called queries.qry
And I am trying to query my assets and transaction for now.
my code
//queries.qry
query AllAssetData {
description: "Returns All the data in th registry"
statement:
SELECT org.consentmanagement.asset.x
}
query AllTransactionData {
description: "Returns All the data in th registry"
statement:
SELECT org.consentmanagement.transactions.y
}
Now after creating a bna file and then a card. I Deployed it on the fabric I have using composer.(Using following code)
composer network install --card PeerAdmin@hlfv1 --archiveFile example.bna
composer network start --networkName trial --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin@hlfv1 --file admin@trial.card
composer card import --file admin@trial.card
composer network ping --card admin@trial
And deploy a REST server with it using
composer-rest-server -c admin@ltrial -n never -u true -d a -w true
Now when I open localhost:3000
and click on "Query: Named queries "
I don't get the queries I have coded, I just get this
I found the answer.
The composer-rest-server was not updating as it was still following version 0.0.1
. (Which was the older version that did not have queries)
The solution is to change your versions to change 0.0.1
to0.0.2
in your package.json
and upgrade the network by following steps
composer archive create -t dir -n . -a dist/trial.bna
cd dist/
composer network install --card PeerAdmin@hlfv1 --archiveFile trial.bna
composer network upgrade -c PeerAdmin@hlfv1 -n *nameOfnetwork -V 0.0.2
and relaunch your composer-rest-server
Use This If you are stuck somewhere
composer archive create --help
composer network --help
composer network install --help
composer network upgrade --help