什么是DS.RESTAdapter的预期JSON响应的完整列表?
我正在尝试为Ember.js应用程序编写一个定制的基于express.js的服务器。 我相处得相当好,但我不断陷入困境,试图猜测Ember Data在给定时刻期待的JSON响应。
这个全新的文档是一个很好的开始http://emberjs.com/guides/models/the-rest-adapter/但不够完整。
我在黑暗中的刺伤使我明白(Ember pre4,Ember Data 11):
Context Server URL Method Req. Data Resp. Data ~~~~~~~ ~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~~~~~~~~~~ Getting a list of all users /users GET {"users":[{...},{...}]} Getting a particular user /users/123 GET {"user":{...}} Creating a user /users POST {"user":{...}} ??? Updating a user /users/123 PUT {"user":{...}} ??? Deleting a user /users/123 DELETE ??? ??? Creating a user (bulkUpdate) /users POST {"users":[{...},{...}]} ??? Updating a user (bulkUpdate) /users/bulk PUT {"users":[{...},{...}]} ??? Deleting a user (bulkUpdate) /users/123 DELETE ??? ???
有人可以帮我填补这些空白吗?
编辑预期的JSON响应的完整列表
这些响应是从实验数据REST适配器unit testing以及通过观察示例Ember数据应用程序上的networkingstream量收集的。
Context Server URL Method Req. Data Resp. Data ~~~~~~~ ~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~~~~~~~~~~ Getting a list of all users /users GET {"users":[{...},{...}]} Getting a particular user /users/123 GET {"user":{...}} Creating a user /users POST {"user":{...}} {"user":{...}} Updating a user /users/123 PUT {"user":{...}} {"user":{...}} Deleting a user /users/123 DELETE N/A null Creating a user (bulkCommit) /users POST {"users":[{...},{...}]} {"users":[{...},{...}]} Updating a user (bulkCommit) /users/bulk PUT {"users":[{...},{...}]} {"users":[{...},{...}]} Deleting a user (bulkCommit) /users/bulk DELETE {"users":[1,2]} {"users":[1,2]}
而不是在黑暗中刺伤,看看rest适配器testing
例如,要填写有关批量更新的响应数据的问题, L738描述了预期的响应数据:
ajaxHash.success({ people: [ { id: 1, name: "Brohuda Brokatz" }, { id: 2, name: "Brocarl Brolerche" } ]});
目前查找短语ajaxResponse(
在rest-adapter-test.js
嵌套在test("create - a payload with a new ID and data applies the updates"
源代码test("create - a payload with a new ID and data applies the updates"
rest-adapter-test.js
test("create - a payload with a new ID and data applies the updates"
看起来像是读取服务器所需响应的块。
- 使用哪一个,AngularUI Bootstrap或AngularStrap?
- UIWindow endDisablingInterfaceAutorotationAnimated错误出现在控制台中时,仅在iOS9中从collectionView以交互方式解除键盘