Hyperledger REST Server Angular Web App getting co

2019-06-04 07:44发布

I'm following the great Hyperledger Composer tutorials here to getting started. I've managed to get everything running, including the REST Server and the Skeleton Angular web app on top of it.

Problem arise when I try to use the application outside of localhost. I can access the REST Server on port 3000 and interact with it (adding, removing, uppdating). I can also access the application (port 4200), but when I try to interact with it I get the following:

Error: Could not connect to REST server. Please check your configuration details

I've tried to update the angular-cli to support my current startup script as: ng serve --host 0.0.0.0 --disable-host-check --public my.ip.address.here:4200 it seems to be working because I get the security warning about disabling host check but it's not solving the problem.

Any suggestions would be much appreciated. Thank you in advance.

4条回答
等我变得足够好
2楼-- · 2019-06-04 08:05

I solved it. Was an easy fix. I needed to edit the file: my-app/src/app/configuration.ts. The line

public ApiIP: string = "localhost";

Change that to your external IP.

查看更多
爷的心禁止访问
3楼-- · 2019-06-04 08:05

i have this environment:

Hyperledger Fabric v1.2
firefox v61.0.2 , node v8.11.3, Composer v0.20, yo v2.0.5
macOS 10.13.5

i had the same error, so I've changed the answer of "Should namespaces be used in the generated REST API?" from "Namespaces are not used" to "Namespaces are used" and it worked, i'm not sure whether this is gonna help you.

查看更多
仙女界的扛把子
4楼-- · 2019-06-04 08:13

sounds like you need to give it a hostname it can resolve to.

I believe its in the "host:" parameter in server/config.json file in your generated app directory to assign a new hostname or IP (and make sure you can access it on the network, eg. routing etc).

查看更多
We Are One
5楼-- · 2019-06-04 08:22

I opted for namespaces used and also you have to start the angular app with npm start instead of ng serve These two things solved my issue hope it will be helpful for you.

查看更多
登录 后发表回答