How API mocking works
API mocking involves creating a mock API server that returns the pre-configured response for any request from the client on that route. This mock API server is the placeholder for the actual server, which is not available for a variety of reasons. Figure A.1 illustrates how API mocking works.
Figure A.1 – API mocking
The mock API server can be local or public and it helps temporarily remove the dependency between the frontend and backend components. It is vital to remember that the API server responds purely based on the incoming request and in no way provides a real picture of the data on the server side.
Having understood how API mocking works, let us quickly set up a mock API using Postman.