How to avoid nesting structure of callbacks with promises? [finished]
问题 I am using promises to avoid the nesting structure created by callbacks. However in this code I still have some nesting. Is there something I am doing wrong or is this un-avoidable in this case? In this case I want to check and see if a profile exists and if it does not I want to create it. DB.getProfile(id_google).then((resGet) => { if(!resGet[0]){ console.log('PROFILE - NOT FOUND - MUST CREATE'); DB.createProfile(id_google, email, name, pic_url).then((resCreate)=>{ console.log('PROFILE