0

I am trying to mock the service response using JSON-server.

Actual URL is: message-service/notifications?id=xyx

I am mocking this URL to hit a dummy URL through JSON-server:

{
    "/message-service/notifications?id=:id": "/notifications/:id"
}

my Json object looks like this:

"notifications": [
        {
            "id": "xyz",
            "getNotificationsResponse":{ }
        }
]

The problem is JSON-server is not hitting the dummy URL to fetch the data. What should be changed here to make the JSON server respond with the data?

Error i am getting in console:

Request URL:http://localhost:9081/message-service/notifications?id=xyz
Request Method:GET
Status Code:404 Not Found
TnJ
  • 43
  • 4
  • This is not an answer, but an alternative. You can try https://beeceptor.com if that helps you mock just like JSON-server. You shall not run a localhost server, but a hosted endpoint for all your mocks. – ankitjaininfo Nov 18 '17 at 14:05

1 Answers1

0

Try to change 'localhost' on your Wi-Fi IP address: localhost:9081 => 111.111.1.1:9081

Mac - System Preferences - Network - 'Wi-Fi is connected to 'your network name' and has the IP address 111.111.1.1'.

COdek
  • 883
  • 6
  • 6