How to extend Composer rest Server

0 votes

I made a Hyperledger composer Network. I want to see My function that have a query code.

for example, My function' content is

 * @param {}  tx  - the member to be processed
 * @transaction
function selectUserByCertificateName (tx) {
  var idList = [];

  query("selectCertificateByName" , {targetName: tx.certificateName })
  .then(function (certificateList) {
     certificateList.forEach(function (certificate) {
  }).then(function () {
     idList.forEach(function (id) {
        query("selectUserById" , {targetId: id })
        .then(function (userList){


this case, I attempt to console.log. I want to see this result(userList) in my angular page.

In angular, http.get method is used for receiveing rest-server data
but, I don't know how to editing composer-rest-server response format I want to sending userList to rest Response.

How to extend Composer rest Server ?

Sep 20, 2018 in Blockchain by sabby
• 4,390 points

1 answer to this question.

0 votes

 It looks like you want to query something from the custom composer-rest-server having access to your deployed Business Network.

As you want to build a REST query endpoint at the end, you have to implement a simple Hyperledger Composer Query definition. composer-rest-server offers all your query definitions as a GET request.

To learn and understand I can highly recommend you this Composer & REST server query tutorial. Another thing I'd like to recommend you is not to work with console.log at all in transaction processor functions. The logged results can only be seen when executed in a browser connection in Composer Playground or when the code is executed through unit/Cucumber tests.

answered Sep 20, 2018 by Perry
• 17,100 points

Related Questions In Blockchain

+1 vote
1 answer

I am unable to change port of composer-rest-server. Please help!

Use full format for running a business ...READ MORE

answered Mar 27, 2018 in Blockchain by Christine
• 15,790 points
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
0 votes
1 answer

How to use different network cards for multiple composer rest server users?

You are getting the same network card in ...READ MORE

answered Dec 6, 2018 in Blockchain by Perry
• 17,100 points
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP