Creating the shop business logic
As we explained in Chapter 5, React with Rematch – The Best Couple – Part I, in the Preparing the environment section, we're using an interesting NPM module named json-server
(https://github.com/typicode/json-server) that converts static JavaScript Object Notation (JSON) files to API endpoints ready to use. This module is really powerful for this book because it will allow us to call a fake API to access the data. A real API recovers the data from a database, but in our case, this data is just static. However, the way this data is accessed from our side, on the frontend, is the same as would be employed in a real API.
When we start our application with yarn dev
, it automatically runs a server on http://localhost:3000
to see the refreshed changes of our frontend application, while also running a server on http://localhost:8000
. If we access this URL, we should see something like this: