在hyperledger-composer中部署角度应用程序 [英] Deploying an angular application in hyperledger-composer
问题描述
我的composer-rest-server
运行在端口3000上,现在我尝试按照
I have my composer-rest-server
running on port 3000 and now I try to generate an angular application with yo hyperledger-composer
following the tutorial.
创建网络应用的步骤:
执行npm start
后,似乎可以正确创建webapp,因为我可以使用curl localhost:4200
从本地主机访问它,但是当我尝试从其他主机访问它时,却什么也没得到.
After I do npm start
and it seems that the webapp es correctly created because I am able to reach it from the localhost with curl localhost:4200
but when I try to reach it from another host I get nothing.
两台主机都已连接,因为我可以访问在端口3000上运行的composer服务器.
Both hosts are connected because I can reach the composer server running on port 3000.
推荐答案
您需要更改Angular应用的配置信息(用于安装)-它基于您当前要配置的IP地址,您要从远程"访问':
you need to change your Angular app's configuration info (for the install) - it is based on your currently configured IP address, that you want to access from 'remote':
1)更改您的Angular骨架应用-例如对于名为my-app
的应用程序-其文件my-app/src/app/configuration.ts
(其中my-app是生成的应用程序目录).对于您选择的网络接口/可解析主机,更改属性:
1) Change your Angular skeleton app - eg. for application named my-app
- its the file my-app/src/app/configuration.ts
(where my-app is the generated app dir). For the network interface/resolvable host you chose, change the property:
public ApiIP: string = "localhost";
成为您的IP或可解析的主机.
to be your IP or resolvable host.
2)构建后,您可以根据需要进行更改-特别是在package.json
中将ng serve --host 0.0.0.0
更改为ng serve --host {MY_IP}
的位置(其余部分留在其中!)-请参见以下示例:
2) After building, you can change it as you wish - specifically where it says ng serve --host 0.0.0.0
to ng serve --host {MY_IP}
in your package.json
(leave the rest in!)- see example below:
"start": "concurrently \"ng serve --host 10.0.0.1\" \"npm run my-app\"",
这篇关于在hyperledger-composer中部署角度应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!