-
Notifications
You must be signed in to change notification settings - Fork 22
Home
Adriaan edited this page Nov 29, 2017
·
11 revisions
ember-data-url-templates is an ember addon to allow building urls with url templates instead of
defining buildURL
(as described in RFC #4).
Url templates are compiled with geraintluff/uri-templates, which fully implements RFC 6570 (level 4).
- Installation / Getting Started
- URI Template Format
- Customizing Request Types
- Defining Custom urlSegments
- query & queryRecord
- Other Resources
// adapters/comment
import Ember from "ember";
import DS from "ember-data";
import UrlTemplates from "ember-data-url-templates";
const { inject, computed } = Ember;
export default DS.RESTAdapter.extend(UrlTemplates, {
urlTemplate: '{+host}/comments{/id}',
createRecordUrlTemplate: '{+host}/users/{userId}/comments',
session: inject.service(),
urlSegments: {
userId() {
return this.get('session.userId'),
}
}
});