On Tuesday, October 7, 2014 3:44:37 PM UTC+2, dmank wrote: > > Hey all, > > I'd appreciate some input on a design decision that I'm trying to make. I > have a product that has a fairly robust REST API, with around 100 endpoints > and options. My hope is to setup a Node/Express/Angular stack with modules > and libraries on each level to query that REST API, abstracting out the > mechanics and specifics of the calls for other developers. The goal is to > have as little code as possible (both for myself and the developers) and > keep the configuration fairly basic. > > Let me setup an example, lets call the product that hosts REST services > "DocManager" and it has hundreds of endpoints - three of which are "List > Files", "Get File Details" and "Update File". I'm struggling with the > following options: > > - *Option #1*: Develop a* "docmanager-rest-client"* nodejs module > responsible for wrapping *each *DocManager REST call (List Files, Get > File Details, Update File), rely on the developer to build the routes and > controllers to consume the functions. No work in Angular. > - *Option #2*: Develop a *"docmanager-rest-proxy"* using http-proxy to > proxy/pipe REST requests from DocManager directly to Angular through > nodejs. All abstraction is done in Angular. > > You may want to take a look at LoopBack, our API framework built on top of express:
http://loopback.io/ It will allow you to mix both options: - On the server, you can declaratively map DocManager REST interface onto an object-based REST API to be consumed by your front-end. - Where appropriate, you can add your custom function to extend the models provided by DocManager. - On the client, you can generate ngResource definitions for your server api by running a single command or as part of your Grunt/Gulp build. - Where appropriate, you can implement extra logic that does not belong to the server. Miroslav -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/3ee3c779-818d-41e5-a8b2-a473ebe94a1a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
