Nilesh C
Nilesh C

Reputation: 697

Ember.js & REST API

From all the various examples of Ember.js, I have not been able to figure out if there is a default method in Ember.js to do REST AJAX calls. Many examples build their own interfaces for CRUD operations. I even tried to sift through the code to find any reference to AJAX calls but came up with nothing.

So, my question is, is there a default implementation of REST API in Ember.js. If yes, how do I use it? Also if, for a specific application, I want to build custom CRUD methods, where do I plug these into Ember.js?

Upvotes: 22

Views: 17313

Answers (4)

Tom Smykowski
Tom Smykowski

Reputation: 26089

Ember.js can work nicely with Ember Data. That said, there is a specific format of REST to follow. When followed, you can streamline the process of connecting API with Ember and have so much less work.

In case you use custom REST, the place to adjust is:

  • adapter - to inform from where you like to get data
  • serializer - how data should be adjusted for custom REST API

Upvotes: 0

Dan Gebhardt
Dan Gebhardt

Reputation: 3281

[2014-02-18: Deprecated - I no longer support ember-rest because it is overly simplistic, and would recommend using ember-data for most ember projects. Check out the Ember guides for an overview of ember-data as well as this example project ]

While learning Ember, I decided to create a very simple Ember REST library. I also wrote an example Rails CRUD app.

My goals were to keep this project as simple as possible, while still including error handling and validation. Ember REST is certainly much leaner than Ember Data and Ember Resource, and I hope you'll find the code well commented and accessible.

Upvotes: 18

oruen
oruen

Reputation: 728

There is a Ember Resource library aiming REST JSON interfaces. It provides Ember.Resource class with save(), fetch() and destroy() operations that could be easily overriden. Looks like it should be more mature than Ember Data for now.

Upvotes: 8

hectorsq
hectorsq

Reputation: 76986

It seems that Ember Data is what you are looking for. It is part of emberjs organiztion in GitHub.

Upvotes: 25

Related Questions