谁拦截了 hyperledger composer 的 restapi 调用
who intercepts restapi call of hyperledger composer
我们正在使用 hyperledger composer 来开发和部署 BNA 文件作为链代码。我们需要自定义一些交易的 return 类型,不幸的是我们无法做到,因为 return 类型被认为与输入类型相同。
为了自定义 return 类型,我们想要拦截其余的 api 调用并在 API return 之前对输出进行更改。
为了实现上述目标,我有 2 个问题 -
1) 当我们调用restapi哪个JS文件拦截了请求?
2) 如果有人可以帮助我们理解 hyperledger composer 如何端到端地处理事务 rest api 调用,那将会有所帮助吗?
我们正在使用 hyperledger fabric 1.0 来存储区块链。
其余 api 调用的 curl 语句示例,用于创建或更新名为 Customer-
的资产
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{}' 'https://<serverinst>:3000/api/Customer'
请求正文 -
{
"$class": "org.network.garment.Customer",
"CustomerId": "string",
"Address1": "string",
"Address2": "string",
"Authkey": "string",
"City": "string",
"Country": "string",
"Email": "string",
"Mobile": "string",
"State": "string",
"UserType": 0
}
感谢任何帮助。
它在幕后使用了 Loopback 框架 - 所以关于 Composer REST 服务器的更多信息在这里 https://github.com/hyperledger/composer/wiki/Composer-REST-Server. You can generate your own customised REST server (that is equivalent to Composer REST server in functionality) to customise as you wish https://hyperledger.github.io/composer/latest/integrating/customizing-the-rest-server - 这将生成一个 Loopback 3 应用程序。
此博客对于自定义 return 类型应该很有用 -> https://dzone.com/articles/customization-of-rest-apis-in-loopback-application
我们正在使用 hyperledger composer 来开发和部署 BNA 文件作为链代码。我们需要自定义一些交易的 return 类型,不幸的是我们无法做到,因为 return 类型被认为与输入类型相同。 为了自定义 return 类型,我们想要拦截其余的 api 调用并在 API return 之前对输出进行更改。 为了实现上述目标,我有 2 个问题 -
1) 当我们调用restapi哪个JS文件拦截了请求?
2) 如果有人可以帮助我们理解 hyperledger composer 如何端到端地处理事务 rest api 调用,那将会有所帮助吗?
我们正在使用 hyperledger fabric 1.0 来存储区块链。
其余 api 调用的 curl 语句示例,用于创建或更新名为 Customer-
的资产curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{}' 'https://<serverinst>:3000/api/Customer'
请求正文 -
{
"$class": "org.network.garment.Customer",
"CustomerId": "string",
"Address1": "string",
"Address2": "string",
"Authkey": "string",
"City": "string",
"Country": "string",
"Email": "string",
"Mobile": "string",
"State": "string",
"UserType": 0
}
感谢任何帮助。
它在幕后使用了 Loopback 框架 - 所以关于 Composer REST 服务器的更多信息在这里 https://github.com/hyperledger/composer/wiki/Composer-REST-Server. You can generate your own customised REST server (that is equivalent to Composer REST server in functionality) to customise as you wish https://hyperledger.github.io/composer/latest/integrating/customizing-the-rest-server - 这将生成一个 Loopback 3 应用程序。
此博客对于自定义 return 类型应该很有用 -> https://dzone.com/articles/customization-of-rest-apis-in-loopback-application