Okay, I can't stand anything like resource, plain http, restangular, restmod, breezejs etc.
I need good(in my opinion) library to work with REST API, which has paginated, sortable, nested resources and some additional resource/collection methods. That's all we need, anyone needs to forget about writing crappy code in this part of project.
All I actually need is described here:
- Model class should be able to have instance methods:
user.deactivate(). It is easy to extend resource object prototype, so it is fine. Every library can do it.
- Model class should have method to get collection of data:
User.findAll(active:true). Trivial, every library can do it, but not all can support get-params in easy way.
- Model class should support relations: if I said user field of Document object is User, it should be User intance after retrieving:
doc.user.get_karma(). Rarely libraries support this thing. Yea, we can add interceptor to do it manualy, but... it is essential, damn.
- Model Collection should be able to have instance methods:
users.delete(). Simple, isn't it? Most libs return simple array.
- Model Collection should be able to support array or object data(paginated/non paginated). Even
- Model Collection should be able to be paginated in same instance:
Backbone.Paginationhas solid solution.
- Model Collection should be able to be ordered by fields(server-side) in same instance:
- Model Collection shoud have method to filter it's data by new filters(to extend filters and resync data):
coll2 = coll.filter(age: 10). Main reason I cannot stop at
Read before commenting!!! There is nothing superior in these features and it is common things we need in any project or even simple app, so there should be common solutions which has all this basic things solved together, right?
Is there at least ONE library, which does all this things?