Working with a Local Data Source
Learn to interact with the back-end server and receive data from the local data source.
Let’s set up our application to interact with the back-end server. We need to make a directory named api in our application’s main directory. Let’s create a directory and a products.json file in the public directory of our application.
Setting up JSON data in the products.json file
Let’s open the products.json file and add the product JSON data:
Adding a local data source in category route
Assume that our data is coming from the server. Let’s configure our routes accordingly. We open the app/routes/category.js file and make it fetch the data from our API: