I'm trying to create a web application using nodeJS and I'm stuck because of the asynchronous nature of nodeJS.
I have three different environments and based on user input from html form I should check if a user exists in the selected environment.
The html will have 3 check boxes and user can select any number of environments.
if(Dev_Environmnet){
getUserDatafromEnvironment(user,environment, function(callback1)){
if(callback1.error){
// User Does Not Exist Or credentials are wrong
}
else{
//get User API
}
});
}
if(PVS_Environmnet){
getUserDatafromEnvironment(user,environment, function(callback1)){
if(callback1.error){
// User Does Not Exist Or credentials are wrong
}
else{
//get User API
}
});
}
if(Prod_Environmnet){
getUserDatafromEnvironment(user,environment, function(callback1)){
if(callback1.error){
// User Does Not Exist Or credentials are wrong
}
else{
//get User API
}
});
}
once this is done I need those results from the callbacks to print it to another HTML page. this is what I need to show on the next page
DEV - API key gdeuysgdsgddiudgqwywdgAguiegdhsiw
pVS - user does not exist or credentials are wrong
Prod - APYI Key ugehdfiyugfugew%$%$udisfiuhygyig
I'm not able to get all these values at once. Can someone help me?