问题
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.
Steps creating the webapp:
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.
Both hosts are connected because I can reach the composer server running on port 3000.
回答1:
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) 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";
to be your IP or resolvable host.
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\"",
来源:https://stackoverflow.com/questions/47262477/deploying-an-angular-application-in-hyperledger-composer