我定义了一个包含 API 的 CorDapp。但是,当我部署 CorDapp 并运行节点时,我在 Web 服务器 URL 上看到以下消息:
No installed custom CorDapps.
如何让节点的内置网络服务器加载我的 API?
为了让节点的内置网络服务器加载 API,您必须做两件事:
-
创建一个WebServerPluginRegistry
列出您的 API 的类(example https://github.com/corda/cordapp-example/blob/release-V3/kotlin-source/src/main/kotlin/com/example/plugin/ExamplePlugin.kt#L12):
class MyWebPlugin : WebServerPluginRegistry {
override val webApis = listOf(Function(::MyApi))
}
-
在下面列出您的网络插件的完全限定类名称resources/META-INF/services
,在一个名为net.corda.webserver.services.WebServerPluginRegistry
(example https://github.com/corda/cordapp-example/blob/release-V3/kotlin-source/src/main/resources/META-INF/services/net.corda.webserver.services.WebServerPluginRegistry)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)