When we separate a web application into frontend and backend, we create a dependency issue. The backend often needs to be built first, before the frontend can start. In this chapter, we’re going to look at how we can build the frontend without having the backend implemented. This will free us up to start developing straight away. It’ll also allow us to catch design issues sooner, while it’s still cheap to add them into the backend.
Before we build the frontend, however, we have several options to consider, mostly related to the question, “Where should we mock?” We have the following options:
- Mock the data on the view layer.
- Mock the data in a central data store (think Redux, MobX, RxJS, etc.).
- Set up a mock API server.
The first option is the quickest, but the messiest. We’d need to be careful about where we’ve added mock data and when we remove it. That approach should only be used for very short-lived tests.