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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.