Page 1 of 1

JavaScript file for REST URLs

Posted: Thu May 24, 2012 2:44 pm
by janick.eisert

It would be nice to have a "global" JavaScript file where the URLs of the rest services are defined. At the moment, in every js file are all rest URLs defined...


JavaScript file for REST URLs

Posted: Thu May 24, 2012 3:36 pm
by maxkatz

You can use Setting service to define such things. Settings service is pretty much works like a property file:

url=http://myservice.com

Then use it in the service for URL or request parameters:

{url}


JavaScript file for REST URLs

Posted: Sat May 26, 2012 9:03 am
by ScottIncz

How can you make a service URL come from local storage variable?


JavaScript file for REST URLs

Posted: Sat May 26, 2012 9:59 pm
by maxkatz

In the service, define the URL to be {url}. Then, create a request parameter called 'url'.

When you do mapping for this parameter, in JavaScript run this:

localStorage.getItem('url');