Creating, reading, updating, and deleting records with Ember Data

In the previous recipe, we retrieved already existing book data from our mock server and displayed it to the user. Ember Data also has the ability to create, delete, and even update records from the data store. We will be looking at these methods and more.

Getting ready

Just like the previous example, we'll need to install Ember CLI Mirage. Take a look at the previous recipe for instructions on this process. We'll be using the same factories as the book recipe and we'll be adding new methods to add, edit, and delete data.

  1. In the mirage folder, open the config.js file:
    // app/mirage/config.js export default function() { this.get('/books'); this.get('/books/:id'); this.put('/books/:id'); ...

Get Ember.js Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.