在开发Hyperledger Composer应用程序时,有一个典型的解决方案体系结构如下:
根据文档,还有一种使用Node.js的替代解决方案架构(请参见https://hyperledger.github.io/composer/latest/applications/node):
为什么要选择第二种体系结构(使用node.js),因为这需要更多步骤:不仅需要编写一个node.js应用程序,而且还必须为此开发前端node.js应用程序(只需2个步骤)。
在第一个架构的情况下,只需创建一个Angular应用程序(因为仅需要启动REST服务器,但是REST API是由框架自动生成的)即可完成(因此只有一个步骤) )。
有没有支持我看不到的使用Node.js的论点?
答案 0 :(得分:1)
The case for node.js is only if you don't want to create a user interface, or, if you wish to create wrappers around the existing hyperledger endpoints that reformat the consumption. A case could be that every day at 5pm you want to post an update to an asset based on what has changed in a different database somewhere... in this case you couldn't use Angular directly.
It's also important to note Angular is exclusively client side, Node.js is exclusively server side, and you cannot serve an API with Angular.
Separation of front end and back end is common practice now and is suggested for applications that contain both. Here's an article on it: https://quickleft.com/blog/six-reasons-we-split-front-end-and-back-end-code-into-two-git-repositories-working-with-github-repositories/