On 23 March 2013 16:01, Dave Hodgkinson <da...@hodgkinson.org> wrote: > So I'm writing an interface to an API. It's a simple info request one. > What top tips do we have for writing one that doesn't suck? I'd > just go for a new that takes the auth info, methods to go fetch > the information and being lazy, just let the data be accessible > through the selfish hash. > > I'm not going to create objects for all the data objects at this point > nor accessors for the individual fields. Well, maybe a few key ones. > > Suggestions for anything better, lazier, more modern?
This is one of the best API wrappers I've used in a while: https://npmjs.org/package/redis It's great because once I've read the connection docs I can then use it without having to refer back to its docs, and instead use the really good ones at http://redis.io/commands But it does throw is a couple of handy helpers where it is suitable - eg https://github.com/mranney/node_redis#friendlier-hash-commands So really simple to learn, lets me use the core docs easily and helps out a bit when appropriate :) Cheers, Edmund. PS note the super cute queuing of requests until the connection is made: https://github.com/mranney/node_redis#ready