app.get('/', (req, res) => {
function fn() {
return new Promise(function (resolve, reject) {
let value = 123;
if (true) {
resolve(value);
} else {
reject(error);
}
})
.then(value => {
return value
});
}
console.log(fn1()); //这里的打印结果为promise
res.send(fn1()); //这里返回结果为{}
//预期想取得的值为value(123)
})