Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ember-data in a non-RESTful environment

I would like to use ember-data in a project I am building, but the API I am working with does not follow REST conventions.

For example, all the HTTP requests are POST and the naming conventions of the endpoints are unique to the actions they perform. e.g. /api/thing/retrieve would require me to post a JSON object with some parameters, and would return a 'thing' to me.

Do I use the Restful adapter and reopen the class and redefine the various find functions?

OR

Do I have to make a new adapter?

OR

Should I just abandon ember-data and and use ajax in my models(or maybe even controllers)?

I'm not sure how I would handle any of those options. Any guidance would be appreciated.

like image 1000
user1168427 Avatar asked Mar 21 '13 17:03

user1168427


1 Answers

The only information which I have seen on this subject has been an article by the Discourse folks linked below.

http://eviltrout.com/2013/03/23/ember-without-data.html

I personally have toyed around with the reopenClass method in the article, and would probably drop it into a mixin or something to that effect if I had a consistent but non-REST API which I was calling regularly.

like image 50
nrion Avatar answered Oct 18 '22 20:10

nrion