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.
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).
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.
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.
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.