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:
DS.JSONAPIAdapterand optionally, by way of an officially-supported addon
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.
Break for Lunch