RESTAdapter or BasicAdapter for Greenfield project?

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

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.

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

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.

@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?

1 Like