Preferred Ember Data URL and JSON structure for multi
If I have an Ember model named DatabaseType
, and want to use it with a REST adapter for Ember Data (I control the server-side API), what should the API URL look like, and what does Ember Data expect the payload to look like, in terms of CamelCase vs snake_case/underscore, and in terms of pluralizing?
Given that the recommended REST URL structure for multiple words is to use underscores (and not camel case), but also given that Ember Data is picky and opinionated about naming conventions and payload structure:
A. Should the API endpoint be:
CamelCase - /databaseTypes/1/
snake_case - /database_types/1/
B. What should the payload JSON root be?
Get database types -> { databaseTypes: [ ... ] }
Get database types -> { database_types: [ ... ] }
上一篇: 没有ID的数据嵌入对象