我正在尝试使用 JSON-server 模拟服务响应。
实际 URL 为:message-service/notifications?id=xyx
我正在模拟这个 URL 以通过 JSON 服务器访问一个虚拟 URL:
{
"/message-service/notifications?id=:id": "/notifications/:id"
}
我的 Json 对象如下所示:
"notifications": [
{
"id": "xyz",
"getNotificationsResponse":{ }
}
]
问题是 JSON 服务器没有点击虚拟 URL 来获取数据。这里应该改变什么以使 JSON 服务器响应数据?
我在控制台中遇到的错误:
Request URL:http://localhost:9081/message-service/notifications?id=xyz
Request Method:GET
Status Code:404 Not Found