Link to home
Start Free TrialLog in
Avatar of John S.
John S.Flag for United States of America

asked on

Help defining a Javascript object

I am looking for an elegant and easy management solution to test my API's. For instance, we have a DEV environment, a QA environment, and a PROD environment.

Sometimes, for whatever reason, the endpoints do not match in each environment. For example...
DEV:  http://myDevEnvironment.com/Users

QA: http://myQa.com/QAGetUsers

PROD: http://mySite.com/GetAllUsers

Open in new window


So what I would like is a simple script to define the endpoints. I would like it easy to change enviromnents, and assign an alias to the method ( in the above example maybe call the alias "GetUsers"

This would be in a config file. So if I wanted to change environments, I could simply change a variable in the config file. Here is an example of how it would be used:


$.post( GetUsers, function( data ) {
  $( ".result" ).html( data );
});

Open in new window


Of course there can be many endpoints.

Can someone help me define a simple Javascript object or script to get this working?

Thank you!

John
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial