John S.
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...
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:
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
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
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 );
});
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.