Hateoas with Ember Data


#1

Hey Guys,

Does anyone have any example of hateoas with ember data?

I’ve tried to map this json with a model: { “meta”: { “total-pages”: 13 }, “data”: [ { “type”: “articles”, “id”: “3”, “attributes”: { “title”: “JSON API paints my bikeshed!”, “body”: “The shortest article. Ever.”, “created”: “2015-05-22T14:56:29.000Z”, “updated”: “2015-05-22T14:56:28.000Z” } } ], “links”: { “first”: “http://example.com/articles?page[number]=1&page[size]=1”, “last”: “http://example.com/articles?page[number]=13&page[size]=1” } }

It works but I cannot access links and meta in a route. I’ve tried to do this in a route but it ain’t work: […] model() { return this.store .findAll(‘articles’, { backgroundReload: true }) .then((result) => { console.log(result); console.log(result.get(‘meta’)); return result; }); } […]

The console prints undefined on meta line.

I’ve tried to implement a normalizeResponse with a serializer, but it doesn’t work too.

Does any one have a example or some hint about this case? Where is the error?


#2

It should be quite possible to normalize that into a JSON-API payload. If you hadn’t noticed, the forum isn’t used as heavily as it used to be. If you are still having issues here, it might be worth posting on StackOverflow or asking on the help channel in the Ember Slack.