production-environmentrelative-url

What does it mean to make URL relative?


My project is build using Angular and Springboot. In environemnt.prod.ts file I have backend url.

I am not sure what does it mean to make url ralative so that it should use same server url?

enviroment.prod.ts file

production:true,
url:'http://localhost:8080/api/amazon/steven'

Solution

  • The relative URL does not use the full web address and only contains the location following the domain. It assumes that the link you add is on the same site and is part of the same root domain.

    Update environment.prod.ts file

    production:true,
    url:'/api/amazon/steven'