我有一个JSON对象,它包含一个产品的评论数组,我试图使用JSON服务器只访问对象的评论部分。我试图向http://localhost:3000/products/1/reviews
(其中1是产品的ID)发出GET请求,但我得到了一个404错误。
{
"id": 1,
"name": "Product A",
"description": "This is a great product.",
"reviews": [
{
"id": 1,
"rating": 4,
"comment": "I really like this product."
},
{
"id": 2,
"rating": 5,
"comment": "This product exceeded my expectations!"
},
{
"id": 3,
"rating": 3,
"comment": "This product is okay, but I've had better."
}
]
}
1条答案
按热度按时间11dmarpk1#
只要url
http://localhost:3000/products/1/reviews
在浏览器中没有显示任何内容,这就是后端问题,与前端(Vue)无关。检查并修复您的后端API,直到它用您显示的数据响应您。