【发布时间】:2013-07-12 05:23:11
【问题描述】:
我目前运行的服务器提供如下数据:
单一实体
{"id":"11","name":"hello",....}
实体列表
[{single entity format},{},...]
但是,Ember Data 期望数据遵循 JSON API spec,格式为
{"entity":{"id":"11","name":"hello",....}} OR {"entities":[{},{},{}...]}
否则会返回错误:
Your server returned a hash with the key 0 but you have no mapping for it
我目前有一个responseFactory,它会将响应构建为一个映射,其中键是 ember 模型(“用户”/“用户”)实体/列表和值是列表/实体本身
有没有更好/更清洁的方法?
【问题讨论】:
标签: rest ember.js jersey ember-data json-api