Ember Data uses a single data store that can be accessed throughout an application. In this example, we'll create a simple application that retrieves a list of books and displays it to the user.
Before we begin, we'll need to mock data for our server. Ember CLI has a built-in mock server that can handle this situation by generating a basic Express server. However, for the purposes of this recipe, we'll go ahead and use the Ember CLI Mirage add-on. It has more features and is easier to use. You can find more information about Ember CLI Mirage at https://github.com/samselikoff/ember-cli-mirage.
To begin, let's create a new application:
$ ember new BookExample
After the application has been created, let's install the add-on:
$ cd BookExample $ ember install ember-cli-mirage $ ember g factory book
This will install the latest Bower and
npm
packages needed and create thebook
factory for Mirage.To make this recipe work, we'll need to...