rbhargaw
asked on
Different Env API end points AngularJS
I have Angular app which gets the data from Web API. Now to get the data normally I use below code
where API_URL is the location where the Web APIs are hosted.
What is the best way to maintain API_URL for different environment?
Like for Dev, API endpoint will be server1, for QA , API endpoint will be in Server2 and prod will be server3
Is it just enough to have config.js and hardcode the server name based on environment?
$http.post(API_URL + "/PR", JSON.stringify(data), {
headers: {
'Content-Type': 'application/json'
}
}
).success(function (response) {
}
).error(function (error) {
});
where API_URL is the location where the Web APIs are hosted.
What is the best way to maintain API_URL for different environment?
Like for Dev, API endpoint will be server1, for QA , API endpoint will be in Server2 and prod will be server3
Is it just enough to have config.js and hardcode the server name based on environment?
$http.post(API_URL + "/PR", JSON.stringify(data), {
headers: {
'Content-Type': 'application/json'
}
}
).success(function (response) {
}
).error(function (error) {
});
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER