Working with a Local Data Source
Explore how to set up and use a local JSON data source within Ember.js routes. Learn asynchronous fetching and filtering of product data to effectively manage your app's data using Ember Data.
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: