In this section, we are going to create the HTTP GET method that will be mocked by the MirageJS server. Follow these steps to create it:
- For the GET methods, we need to create a new file called get.js in the src/server folder.
- For this recipe, we will make a generic getFrom function that receives a key as an argument and returns a function. This returned function returns a direct point to the local database with the indicated key:
export const getFrom = key => ({ db }) => db[key];
export default {
getFrom,
};