当我返回上一条路线时,在此行中出现错误
meals = data.meals.map(meal => meal);
:
类型错误,无法读取null的属性“ map”
request(options, (error, response, body) => {
const data = JSON.parse(response.body);
if (error) {
console.log(error);
} else {
const meals = data.meals.map(meal => meal);
console.log(response.statusCode);
res.render("result", { categories: meals, title: category });
}
});