I have a website that is mainly based on JavaScript. It uses a REST Service. I have the REST Service URL’s hard coded in the JavaScript page. The URL’s will change from PROD to testing. Every time I deploy this site to a different environment, I need to go and update the .JS file. What is the best way to manage these? is there a better way of doing this?
Share
You can get the URL of the current page the JS is loaded in with
location.href. Using that and some string manipulation you can dynamically create those RESTful URLs.