【问题标题】:who intercepts restapi call of hyperledger composer谁拦截了超级账本作曲家的restapi调用
【发布时间】:2018-07-04 05:59:02
【问题描述】:

我们正在使用超级账本作曲家来开发和部署 BNA 文件作为链码。我们需要自定义一些交易的返回类型,遗憾的是我们无法做到这一点,因为返回类型被认为与输入类型相同。 为了自定义返回类型,我们希望在 API 返回之前拦截其余 api 调用并更改输出。 为了实现上述目标,我有 2 个问题 -

1)当我们调用restapi时,哪个JS文件拦截了请求?

2) 如果有人可以帮助我们了解超级账本作曲家如何端到端地处理事务休息 api 调用,那会有所帮助吗?

我们正在使用超级账本结构 1.0 来存储区块链。

用于创建或更新名为 Customer- 的资产的 rest api 调用的示例 curl 语句

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
}

感谢任何帮助。

【问题讨论】:

    标签: hyperledger-fabric hyperledger hyperledger-composer


    【解决方案1】:

    它在幕后使用 Loopback 框架 - 所以更多关于 Composer REST 服务器的信息在这里https://github.com/hyperledger/composer/wiki/Composer-REST-Server。您可以生成自己的自定义 REST 服务器(在功能上等同于 Composer REST 服务器)以根据需要进行自定义https://hyperledger.github.io/composer/latest/integrating/customizing-the-rest-server - 这将生成一个 Loopback 3 应用程序。

    这个博客对于自定义返回类型应该很有用 -> https://dzone.com/articles/customization-of-rest-apis-in-loopback-application

    【讨论】:

    • 感谢所有的指点。将向您更新进展情况。
    猜你喜欢
    • 1970-01-01
    • 2022-11-10
    • 2018-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-01
    相关资源
    最近更新 更多