【发布时间】:2021-02-21 17:30:01
【问题描述】:
我有 getProductInfo orgianlly,作为两个参数,它会在哪里(res,sku)。但现在我想传递一个带有 sku 编号的集合对象并为每个 res.send 发送数据
const activeProductBank = new Set([6401728, 6430161, 6359222, 6368084]);
getProductInfo = (res) => {
activeProductBank.forEach((SKU) => {
bby.products(SKU, { show:'sku,name' })
.then(function(data) {
res.send(data);
});
})
};
也试过了
getProductInfo = (res) => {
const allProductInfo = '';
activeProductBank.forEach((SKU) => {
bby.products(SKU, { show:'sku,name'})
.then(function(data) {
allProductInfo.concat(data);
});
})
res.send(allProductInfo);
};
我得到“应用程序在 http://localhost:3000 监听”的错误 (node:25556) UnhandledPromiseRejectionWarning: Error: Exceeded max retries"
【问题讨论】:
标签: javascript api express routes