下面是index.js中的方法
function costOfItemHandler(agent) {
const itemName = agent.parameters.foodItem;
const url = "https://fast-beach-13460.herokuapp.com/Eatery";
return axios.get(url)
.then((result) => {
console.log('result is '+ result);
});
在日志中,即将到来的textPayload:“结果是[object Object]”。当我浏览网址时,它会给出正确的响应。
尝试一下:
console.log('result is ', result);
如果将对象附加到字符串,它将返回[对象,对象]。