How does nodejs request synchronize?

  node.js, question

Nodejs made the site,
When requesting api data, you need to request twice (the second time uses the data requested for the first time)
Then in render view;
How can I synchronize?
In addition, the library request-promise was found on the Internet.
But I still use asynchronous.
rp=require(“request-promise”)
图片描述

Is there any solution? I don’t know how to insert the code for the first time. . .

Different promise implementations are different, and the calling methods are also different.
To view the viewer API description
This may be called ~

var promise=new Promise(....);
 promise
 .then(function(resut){
 return new Promise(....);
 },function(error){})
 .then(function(result){
 return new Promise(....);
 })
 .then(function(result){
 //Last Logic
 })
 .catch(function(error){
 //Same exception handling
 });