0

I'm using Angular8, Java8, Maven, and Tomcat 8.0 and I have three environments that I would like to deploy my application with a single build. Angular is an application that handles "One build, one environment". It is possible to tweak it to run more environment at once but to me, it doesn't make sense why this works.

Normally, in a URL you put localhost or any other URL and build the angular project so the dist file will be saved with the chosen URL. This time I just use .. (double dots) e.g. ../rest/endpoint and it is also working in many environments. The double dots trick works if I build the angular project and the URL is dynamically set. So with the double dots trick, my application can run on www.website.com/rest/endpoint and also on localhost:8080/rest/endpoint.

Can someone explain to me this double dots trick?

avocadoLambda
  • 1,332
  • 7
  • 16
  • 33
JojoGangster
  • 31
  • 1
  • 5

1 Answers1

0

I think that you encapsulate REST API interaction with your backend to some Angular service that will have logic of correct backend URL construction. In this service you can construct backend URL with environment variables usage (https://angular.io/guide/build) to vary your builds environment.

Ilia Komarov
  • 623
  • 3
  • 6