Comparison of Restangular vs. JSData (formerly Angular-data) [closed]
Asked Answered
H

0

30

One of the things about Angular that's both a feature and a point of complexity, is that it's not very opinionated about how to interact with a RESTful API. I know about $resource, Restangular, and various ideas you can find on rolling your own.

In a complex application that's got a large number of resources, including various nestings, there's reason to think that Restangular's superior to $resource; for similar reasons, also that Restangular's better than rolling your own.

One solution that I haven't seen until recently is JSData and its wrapper for AngularJS (repo). Judging from the number of favorites on Github (~900), it has a decent number of people at least interested in it, if not using it. It's only a fraction of the following that Restangular has on Github (5k+), but still significant.

For those who have used both Restangular and JSData, what's your take on how they compare (strengths/weaknesses; differences in purpose, reliability, etc.; things that may not be readily apparent from the docs)? For this question to remain open, please stick to facts rather than opinions.

My impressions from what I've read are the following:

Restangular

  • (+) Big mindshare
  • (+) Highly customizable
  • (-) Focus seems to be on the actual interaction with the RESTful API only, rather than also being opinionated/acting as a data store once it's returned (please correct me if I'm wrong). Granted, this could be considered a feature, in the same way Angular's lack of opinion is a feature. I'm putting this is as a disadvantage for now, though, because of the additional legwork this means for the developer to come up with their own solution.

JSData

  • (+) Works not only with REST, but localStorage, localforage, Firebase, etc, including custom adapters
  • (+) Designed as a cached data store to not have to repeat HTTP calls (to be fair, caching is also an option with Restangular, though perhaps less intertwined/critical to its mission)
  • (-) Not as large a following, although the developer does seem committed
Hoeg answered 4/2, 2015 at 20:29 Comment(14)
I find it a little weird you're penalizing RESTangular for only working with RESTful APIs. It's literally in the name.Tellurize
I updated that point in my question to clarify. I'm not penalizing it for focusing on REST; that's fine and good. I'm just saying it doesn't seem to also have a focus on being a data store itself once that data's obtained from the API; I think that's a fair critique of Restangular, though one could argue it's a feature like I mentioned, since it leaves things wide open for the developer to do what they like.Hoeg
If it's using the $http service in angular, correct me if I'm wrong, but can't you just set it to cache the data? (actually asking, never really used http caching on angular)Tellurize
It does seem like that's an option, yes, and I admitted so under the JSData section. Reference github.com/mgonto/restangular#can-i-cache-requests Because I'm not experienced in these 2 libraries, though, that's why I'm asking for insights from the SO community, e.g. in case someone's used both, and thinks JSData's data-store strategy is irrelevant because of Restangular's abilities + the ability to cache API requests. With 2 seemingly good options like these, it's often in the details where one may shine and the other fall short; I don't know what details I don't know.Hoeg
It's possible not many have used it, so my suggestion to you is build a quick nitty gritty Web app on two pages. The only thing you change between them is which data manipulator you're using. If you find one more intuitive, then use it. If they both seem fine, perhaps mock up a larger, more robust fake app? It's generally how I form my opinions on things.Tellurize
I may end up trying both out as you suggest. Given that js-data-angular has just under a thousand favs on Github, though, and Restangular has several thousand, I thought there might be some knowledge out there to share. ThanksHoeg
Neither are really pure REST clients. Restangular for example is limited to HTTP and the verbs and meanings it gives to them. REST by definition does not require it be implemented over HTTP. Read this: #2191336Intelligible
It just doesn't seem like enough people are aware of or are using JSData yet. The answer to this question will become obvious in time. Also, I wouldn't discount JSData because it has sub 1000 favs on Github as it's a lot newer and came along after Restangular already had a large following. IMO, the final answer will take a year or more to see (after the dust settles), but in the meantime I've tried it and it has some good parts for sure.Meissner
@StabbyLorenzo agreed that JSData shouldn't be discounted due to its numbers. IMO ~1000 favs is impressive even. Like you, I'm trying JSData and finding it well built and very useful so far.Hoeg
Comparison questions are not a great fit for stackoverflow - meta.#277776Finalize
I respectfully disagree w/the conclusions at that meta link and how it applies here: 1. I'm not looking for a recommendation. In my time since asking the question, I'm gathering experience on how both have strengths/weaknesses in different contexts, not that one's just better. That insight's what I would've liked at the outset. 2. Honestly not sure what'd be wrong with a useful comparative list on SO. There's lists of other sorts that end up answering questions here and are useful. Given the upvotes and favorites on this question, there's others who'd benefit from this as well.Hoeg
People vote because both projects are of considerable interest, but what precisely is the question here?Development
I find it frustrating that questions like this are always closed. It seems that the community likes them, but mods are eager to close anything that comes across as being remotely opinion-based. If the community wants it, and if the discussion is fact-based, what harm is there in keeping the question open?Fortunato
You buried the lead, you want to discuss concerns when comparing them but you get to it 4 paragraphs in. My team is moving away from pure rest to a CQRS solution. My two cents is that is you want to follow a mapper pattern then restangular isn't for you. If you don't care about that separation of concern then restangular is simpler.Amentia

© 2022 - 2024 — McMap. All rights reserved.