W3cubDocs

/Ember.js 4

Class BuildURLMixin

public
Defined in: ../packages/adapter/addon/-private/build-url-mixin.ts:121
Module: @ember-data/adapter

Using BuildURLMixin

To use URL building, include the mixin when extending an adapter, and call buildURL where needed. The default behaviour is designed for RESTAdapter.

Example

import Adapter, { BuildURLMixin } from '@ember-data/adapter';

export default class ApplicationAdapter extends Adapter.extend(BuildURLMixin) {
  findRecord(store, type, id, snapshot) {
    var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');
    return this.ajax(url, 'GET');
  }
}

Attributes

The host and namespace attributes will be used if defined, and are optional.

© 2022 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember-data/4.9/classes/BuildURLMixin