I know there is a lot of stuff out there explaing the concepts but I am still confused why my node.js example does not work.
I have a main function
function main(){
login()
.then(
function(result) {
return getMyInfo();
}
);
and two API calls (getMyInfo and login) like this:
function login(){
const options = {
...
},
};
return rp(options);
}
Now I want to call my main function from another file
main()
.then(
function(thisIsWhatINeed) {
console.log(thisIsWhatINeed);
}
);
Somehow this still returns undefined for me, can you help you finding out why? In my opinion both login() and getMyInfo() return a promise and therefore main() also returns a promise because it return getMyInfo..