0

我正在尝试使用 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
4

1 回答 1

0

尝试更改 Wi-Fi IP 地址上的“localhost”:localhost:9081 => 111.111.1.1:9081

Mac - 系统偏好设置 - 网络 - 'Wi-Fi 已连接到'您的网络名称',并且 IP 地址为 111.111.1.1'。

于 2018-06-04T10:36:06.943 回答