Hacker News new | ask | show | jobs
by sapeien 3446 days ago
Something very similar already exists: https://github.com/pretenderjs/pretender

I don't think it's a good idea in general to mock server responses because they are subject to change while the mocks don't, better to just run the server and make a real request.

1 comments

The main difference between Service Mocker and pretender is that we are using service worker API, therefore the HTTP requests and responses are real and can be inspected in devtools.

And usually, we mock an API while the server isn't ready to use. For example, when you just started a new project with backend dudes, it's highly possible that the server is unusable for the first few days, that is the best time to mock your APIs with such a tool :).