Hi Matt,

About question 2 you can see in Restangular 
docs: https://github.com/mgonto/restangular#using-self-reference-resources

[]'s

Em segunda-feira, 17 de março de 2014 14h28min08s UTC-3, Matt Kruse 
escreveu:
>
> I'm familiar with the theory of services, REST, etc, but I've never 
> written a full app to consume them until now. So I don't really know what I 
> don't know.
>
> I quickly moved from *$resource* to *Restangular* to get added 
> functionality. It's nice and does what I need, but I kind of expected 
> things to be even simpler than what they are.
> I have a few questions for those who have been through this in depth:
>
> *1)* Is there a tool to *abstract the routing* a bit? I'd like to 
> generate an Angular service, define some endpoints and their methods, and 
> be done. It looks like all the pieces are there to build it myself, but is 
> there an easier way? I consider this kind of like ORM, and I would expect 
> some of it to be generated. Maybe.
>
> *2)* Right now my list services are returning an 'href' attribute that 
> points to the individual record url, like this:
> *url:  /games/1/players*
> [ {id:1,name:"Test",href:"/players/1"}, ... ]
> Is there a better way? *Can Restangular "discover" this routing* in a 
> better way than an "href" attribute embedded in the object which isn't 
> really a field of the object? What if my object has its own "href" 
> attribute?
> Should/can I define this routing in my service, rather than depending on 
> the server to supply it?
>
> *3)* I use *customPOST* to call an endpoint like /players/1/publish. Is 
> there a way the server can tell me that the publish endpoint is available, 
> and the url to it, so it's more discoverable? Or do I have to hard-code 
> this coupling on each side and hope they don't get out of sync?
>
> *4)* What is typically returned by *"state-altering" service calls*? 
> Should I get the refreshed object back? Or some metadata about what has 
> changed? Or just a success message? My worry is that the server has changed 
> the model in some calculated field, and now it's out of sync in my 
> javascript. Should I manually request the object again after each state 
> change?
>
> *5)* Is there any better alternative for consuming REST services than 
> Restangular? The API seems good, and right away it "made sense" to me, as a 
> developer. But there is a lot of configuration options and a lot of 
> "custom" methods, which makes me wonder if it's trying to be everything to 
> everyone. Maybe there is an option that is a little more opinionated with 
> fewer options? I kind of like opinionated frameworks and reusable code. As 
> long as they do what I want, I'll follow their rules. :)
>
> Thanks!
>
> Matt Kruse
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to