Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Commit cb5ea2f

Browse files
committed
Merge pull request #3 from Globegitter/patch-1
Added a simple example
2 parents fb50a08 + a6d6e62 commit cb5ea2f

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ The blueprints in this repository are meant as a starting point to make Sails wo
1313
`!` *On August 18th, [Ember Data 1.0 beta-9](http://emberjs.com/blog/2014/08/18/ember-data-1-0-beta-9-released.html) was released, including a lot of improvements for delivering model associations/relations as Embedded Records (instead of Sideloading). Embedding records is much closer to what Sails does orginally, so it might be better to move into that direction. But since the actual JSON API structure is very different for these two approaches and since most APIs will be designed to work with multiple clients, I'd like to see support/alternatives for both ways. If you happen to know a project that will support the embedded style, please send me a note!*
1414

1515

16-
### Ember Data expectations
17-
18-
Ember Data expects the JSON responses from the API to follow certain conventions.
19-
Some of these conventions are mentioned in the [Ember model guide](http://emberjs.com/guides/models/connecting-to-an-http-server/).
20-
However, there is a more [complete list of expected responses](https://stackoverflow.com/questions/14922623/what-is-the-complete-list-of-expected-json-responses-for-ds-restadapter) on Stackoverflow.
21-
22-
23-
2416
# Getting started
2517

2618

@@ -94,6 +86,20 @@ If you want to access the REST routes with your own client or a tool like [Postm
9486
Accept: application/json
9587
Content-Type: application/json
9688

89+
Furthermore Ember Data expects the JSON responses from the API to follow certain conventions.
90+
Some of these conventions are mentioned in the [Ember model guide](http://emberjs.com/guides/models/connecting-to-an-http-server/).
91+
However, there is a more [complete list of expected responses](https://stackoverflow.com/questions/14922623/what-is-the-complete-list-of-expected-json-responses-for-ds-restadapter) on Stackoverflow.
92+
93+
As a **quick example**, if you create a `post` model under the namespace `api/v1` you can access the model under `localhost:1337/api/v1/posts` and to create a new Record send a POST request using the following JSON:
94+
95+
```js
96+
{
97+
"post": {
98+
"title": "A new post"
99+
"content": "This is the wonderful content of this new post."
100+
}
101+
}
102+
```
97103

98104

99105
# Todo
@@ -121,4 +127,4 @@ The blueprints in this repository should provide a starting point for a Sails ba
121127

122128
This generator is based on the [sails-ember-blueprints](https://github.com/mphasize/sails-ember-blueprints).
123129

124-
@artificialio used these blueprints to create the first version of their Vagrant-based [Sails Ember Starter Kit](https://artificialio.github.io/sane/).
130+
@artificialio used these blueprints to create the first version of their Docker-based [Sane Stack](http://sanestack.com/).

0 commit comments

Comments
 (0)