vendredi 17 avril 2015

Modifying Embers expected json api response

I'm new to Ember and from what I understand it has a very specific way it excepts its json api response to look like. Like so:



{
"post": {
"id": 1,
"title": "Node is not omakase",
"comments": [1, 2, 3]
},

"comments": [{
"id": 1,
"body": "But is it _lightweight_ omakase?"
},
{
"id": 2,
"body": "I for one welcome our new omakase overlords"
},
{
"id": 3,
"body": "Put me on the fast track to a delicious dinner"
}]
}


Now the api I've already built has an json response that looks like so:



[
'data' => [
'foo' => 'bar'
'comments' => [
'data' => [
...
],
'meta' => [
...
]
]
],
];


The api is pretty big and is working fine with the mobile app. So a code re write would be to costly I would just choose another js framework even though I like Ember the best.


So my question is is there any way I can adapt the expected json response in ember. If yes how hard is it? Worth the time or should I just go for Angular or Aurelia.


or am I completely wrong and there is no one expected response to ember?





Aucun commentaire:

Enregistrer un commentaire