我正在学习诺言。为了编写一些“冗长”的内容,我将代码从app.get()中移出并试图从外部函数返回消息.就像这样: varmessage = message(); // I also tried wrapping this in promise and calling `res.json` in `<em
我使用pg-promise,并尝试向用户模型中的数据库发出请求,以获取所有用户的数组,如下所示: let users/ in debug mode data is my expected array return users;但是当我从控制器发出get请求时,它返回promisePromise { <pending>