Currently for environment.development.ts there is configured an apihost variable.
For each dev environment it needs to be adjusted to use the local ip adres.
Currently the file has commented out on which systems it is not running.
To set it to localhost isn't an option, as with that device testing doesn't work.
Jetbrains webstorm runs the angular site on a dev machine with
ng serve --host 0.0.0.0 --disable-host-check
So handheld test devices can connect to it.
I think in essence the client should know from who the website is delivered and based upon that get the backend for api calls as well. And although a compiled angular app is generic can run on multiple webserver it should assume the api calls come from the same server, just on another port. And it shouldnt even matter if its development or production here as the api sits on the same server.
export const environment = {
production: false,
apihost: 'http://10.25.1.109',
//apihost: 'http://10.25.1.15',
//apihost: 'http://10.25.1.111',
//apihost: 'http://10.25.1.129',
//apihost: 'http://10.25.1.7',
//apihost: 'http://localhost',
apiport: 5045,
apiurl: '/api'
};
I have tried without success:
export const environment = {
production: false,
apihost : location.hostname,
apiport: 5045,
apiurl: '/api'
};