努力理解...我有这个
async function fetchUsers(idUser) {
const result = await User.forge({id: idUser}).fetch({columns:['name']});
return result
}
router.get('/users', (req, res) => {
const userData = {
iduser: req.userId,
}
Orders.getOrders(userData, (err, rows) => {
if (err) {
console.log(err);
}
let user = fetchUsers(req.userId);
console.log(user)
console.log('-------------------------------');
console.log(rows)
res.json({orders: rows});
});
});
我在console.log(user)
中得到了诺言{}。