quarkus-quinoa
quarkus-quinoa copied to clipboard
Angular "ng serve" is not answering on http://localhost:4200 from Java
This is referenced there: https://github.com/angular/angular-cli/issues/2375
For some obscure reason, the workaround is to replace ng serve by ng serve --host 0.0.0.0 to make it work.
To reproduce, start ng serve then try this script with jbang:
///usr/bin/env jbang "$0" "$@" ; exit $?
import static java.lang.System.*;
import java.io.*;
import java.net.*;
public class MyTest {
public static void main(String... args) {
try {
URL url = new URL("http://localhost:4200");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setConnectTimeout(2000);
connection.setReadTimeout(2000);
connection.connect();
int code = connection.getResponseCode();
System.out.println(code);
} catch (ConnectException | SocketTimeoutException e) {
e.printStackTrace();
} catch (IOException e) {
throw new RuntimeException("Error while checking if package manager dev server is up", e);
}
}
}
I just found the same problem using plain webpack on the patternfly react seed: https://github.com/patternfly/patternfly-react-seed.git
The same fix works: 0.0.0.0 as HOST.
@ia3andy did you just fix this issue with your new IPV4 vs 6 fix?
Right :)