RESTAdapter or BasicAdapter for Greenfield project?


#1

Can someone point to a difference between use of the RESTAdapter and BasicAdapter and whether one should start a 100% greenfield project using one or the other.

I have been making a lot of progress learning the framework in the last week but mostly I have been working with fixture adapters. My project has a Node.js and MongoDB backend so I feel comfortable architecting the API with either side-loaded or embedded data. However, it isnt clear which Adapter to start with as I dont want to rewrite everything OR wait for Ember-data 1.0 to decide.

Any recommendations?

Brendan


#2

I do not know if I am qualified to answer this, as I have only used the RESTAdapter so far. But from what I gather from the recent blog post the BasicAdapter is meant for accessing inconsistent APIs and/or APIs that return complex JSON data.

To me it looks as if the BasicAdapter is most useful if you need to access legacy and/or third-party APIs, or if you do not need a lot of the complexity of a “full” adapter (e.g. you only read data from the API).

So in your situation, as long as you are fine with following the conventions the RESTAdapter expects, I would definitely recommend going with it.


#3

I think it depends on how comfortable you are with “breaking api changes”. If you are ok with maintaining an adapter or helping to maintain one for your mongo rest api and don’t mind the occasional “upgrade re-learning” I would stick with the full blown ember-data REST adapter as it’s more “complete” from a feature standpoint. The problem is that a great deal of these features are not yet flushed out conceptually (so you will no doubt have to modify your adapter in the future when these things are solid).

If you just want to avoid $.ajax and get a basic abstraction the “BasicAdapter” is worth looking at


#4

I’d say go with BasicAdapter if you need a lot of customization, but definitely give RESTAdapter a try. You might be surprised how good it is at some things.


#5

@darthdeus, @toranb my API is brand new (and still very much in progress) so I feel fairly comfortable using the RESTAdapter for the automatic CRUD implementation but I am confused by what is included in the RESTAdapter or what should or shouldnt be done within the RESTAdapter.

If I need things other than CRUD do I need to create those with $.ajax methods outside of the RESTAdapter or is there a way to do those things within the ‘scope’ of the RESTAdapter?