Ember数据1.0.0 Beta:RESTAdapter端点定制不再有效

cyc*_*arc 4 ember.js ember-data

我正在转换一个项目,用于Ember数据1.0.0 Beta 1(刚刚发布).我有一个REST适配器侦听特定端点,因此需要自定义端点.

这是它在Ember数据0.13中的工作方式:

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

DS.RESTAdapter.reopen({
  url: 'https://api.example.com'
});
Run Code Online (Sandbox Code Playgroud)

在Ember数据0.13中,URL变为: https://api.example.com/authors

在Ember数据1.0.0中,网址变为: http://192.168.0.108:51939/authors

使用/192.168.0.108:51939运行webapp的URL.

因此看起来RESTAdapter的.reopen上的url设置不再有效?

我对URL的其他自定义(例如命名空间)有同样的问题...

希望有人可以提供帮助.

and*_*rov 10

看起来这是在@ cyclomarc的回答后不久更新的(查看PR https://github.com/emberjs/data/pull/1145).在ember数据中,'url'现在是'host'.'命名空间'仍然有效.

DS.RESTAdapter.reopen({
  host: 'http://google.com',
  namespace: 'api'
});
Run Code Online (Sandbox Code Playgroud)

发送请求 http://google.com/api/*

Ember v1.0.0-7

Ember Data v1.0.0-beta.1-17

编辑:现在记录在TRANSITION.md中:https: //github.com/emberjs/data/blob/master/TRANSITION.md#host-and-namespace-configuration