Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember data 1.0.0 Beta: RESTAdapter endpoint customization no longer works

I am converting a project for use with Ember data 1.0.0 Beta 1 (just released). I have a REST adapter listening on a specific endpoint and thus need to customize the endpoint.

This is how it worked in Ember data 0.13:

App.Adapter = DS.RESTAdapter.extend({})

DS.RESTAdapter.reopen({
  url: 'https://api.example.com'
});

In Ember data 0.13, the URL became: https://api.example.com/authors

In Ember data 1.0.0, the url becomes: http://192.168.0.108:51939/authors

with /192.168.0.108:51939 the url on which the webapp is running.

It thus looks like the url setting on .reopen of a RESTAdapter no longer works ?

I have the same problem with other customizations of the URL (such as namespace) ...

Hope somebody can help.

Marc

like image 867
cyclomarc Avatar asked Dec 08 '22 13:12

cyclomarc


1 Answers

Looks like this was updated soon after @cyclomarc's answer (check the PR https://github.com/emberjs/data/pull/1145). In ember data 'url' is now 'host'. 'namespace' stills works.

DS.RESTAdapter.reopen({
  host: 'http://google.com',
  namespace: 'api'
});

Sends requests to http://google.com/api/*

Ember v1.0.0-7

Ember Data v1.0.0-beta.1-17

EDIT: This is now documented in TRANSITION.md: https://github.com/emberjs/data/blob/master/TRANSITION.md#host-and-namespace-configuration

like image 87
andorov Avatar answered Dec 11 '22 03:12

andorov