To simulate that we are making an HTTP call to an API to get the details of our user, we need to set it up first using Mockoon. If you don't have it set up, check the instructions on how to install it in Chapter 2, A Form in its Simplest Form, in the Bringing in Axios section of this book.
Let's look at how to create a mock API endpoint. Follow these steps:
- Open up the app and click on the Add route button in the second column. This will add a new route to the list in that same column. Click on it to select it and the pane on the right-hand side will update to show the information for this particular route:
- Under Route settings, where you can input the name of the route, leave the verb as GET and set the name of the endpoint as user:
- Now, go to the Body section of the panel and set up the dummy data that we will be returning from...