I would go with option #2 This keeps your node.js lean. If you ever need an API endpoint that is too specific to your angular app to be in the main application, you can modify your proxy to do some funny stuff. Otherwise keep it a simple proxy to your original endpoint.
On Tuesday, 7 October 2014 15:44:37 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. > > Are these community-acceptable approaches? Are there any approaches that > I'm missing here? (Authentication is taken care of in either case through > custom security) > > -- 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/cf0ef12a-2385-430e-bf12-50ed9c033cb4%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
