Ember-Data Basics

As the official persistence library of the ember.js framework, ember-data has become more performant, more customizable, and an even more valuable library over time.

Ember-Data Basics

Building Requests

Ember-data adapters are responsible for building URLs, and making other customizations to outgoing requests. We'll begin by establishing the URL & JSON contracts that ember-data has turnkey adapters for, and then explore a wide range of customization hooks that you can use to make ember-data work with your API.

  • Building RequestsBuilt-in Adapters

    Ember-data ships with three types of adapters:

    We'll look at the kinds of APIs these types of adapters are designed to work with, and the types of functionality they each provide.

  • Building RequestsRequest Types & Customizing URL Building

    We often need to customize the way URLs are built for creating, updating, deleting or retrieving resources. We'll study ember-data's 10 request types, each of which comes with its own url-building customization hook. We'll examine several examples in detail:

    • Building URLs for hierarchical resources
    • Using the ember-data snapshot API
    • Moving queryParams to path params

    Finally, we'll look at the caching ramifications of different types of requests, and provide some battle-tested patterns for adapter customization.

  • Building RequestsExercise: Building Adapters for Awful APIs

    I've got four apps that will work properly only when the ember-data adapter layer is sufficiently customized. Separate into four teams, and each team will fix one app using the adapter strategies we've outlined this morning. Each group will present their solution(s) to the rest of the group when complete.

  • Building RequestsLunch

    Break for Lunch

Clever Caching

Ember-data's caching features are often under-utilized, resulting in extra time to fetch data with each page load. We'll explore some simple caching strategies that will translate to major performance gains!

Featuring: Fastboot

We'll look at how ember-data's store can work hand-in-hand with Ember's server-side rendering technology, by way of a fastboot feature called shoebox storage, to land pages on the screen with lightning speed!

Helpful Hooks

Ember-data is easier to customize than ever, but it takes experience to find the right balance between an tangled application adapter monolith, and dozens of single-purpose modules that repeat common logic.