please help me with following: how to render multiple instances which are comming from anydata base (in my case from Gcloud datastore, before it was MongoDB but it does not actually matter), as i understand Handlebars can accept/parse objects or array or objects, so now im doing this way Im importing functions that returns a promise
const someFunction = require('from somewhere');
somedatabase query (err, apiResponse) => {
>>> someFunction ().then(someFunctionResponse=> {
res.render('index', {
x: apiResponse,
y: someFunctionResponse,
});
});
})
im using one inside other, Is this a right way ? I dont see any other way to resolve promise and pass it to res.render
It works fine but just to be sure / more professional
Answer is to use Promise.all()
thats it. In case
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.