CouchDB and Node.js - What module do you recommend?

36,162

Solution 1

Try to look at nano which offers simple and minimalistic API for CouchDB or high-level client cradle.

Solution 2

When getting started, do not use CouchDB libraries in NodeJS!

There several, however they are largely thin layers wrapping the HTTP API. But Node has very strong HTTP support. It's no more trouble to make simple HTTP queries. It's simpler. It's less prone to errors. When CouchDB adds a feature, you won't need to wait for library support. You will learn and understand CouchDB better. It's well worth avoiding a library at first.

I use the built-in querystring module, and also Mikeal Rogers's request library, which is a super thin HTTP convenience library.

Solution 3

I am the author of nano. When starting with CouchDB I did exactly as Jason Smith advised using Mikeals request library. Nano was born out of using that code in production and realizing I had some coded that could be improved and abstracted.

The end result is minimalistic and you still have a way to go down to the request level and do a request (which many users do).

Nano was really well accepted by the CouchBase team, mostly cause it's soo\ simple and maps well to the API.

If you are interested in checking out more check out this blog post: http://writings.nunojob.com/2011/08/nano-minimalistic-couchdb-client-for-nodejs.html

Solution 4

I've written a very clean and simple HTTP API wrapper, called node-couchdb-api. It doesn't add any bloat features like an ORM, and it follows typical Node.js conventions for callbacks and async code.

Share:
36,162

Related videos on Youtube

cllpse
Author by

cllpse

Designing and developing websites and app's for close to two decades.

Updated on July 05, 2022

Comments

  • cllpse
    cllpse almost 2 years

    What modules are you using to connect to your CouchDB server, in your Node.js applications? And why would you recommend whatever module you are using?

  • cllpse
    cllpse about 13 years
    Good advice. I've actually done a JavaScript wrapper for CouchDB, though :)
  • JasonSmith
    JasonSmith almost 13 years
    While I'm here back on this question, I shared my anti-client opinion with Charlie Robbins from Nodejitsu. He understood, and he said Cradle had gained many features and was indeed worth the conceptual complexity overhead.
  • Eric
    Eric over 12 years
    I'm having some problems with that. Can you try to reproduce it on your machine?
  • Dominic Barnes
    Dominic Barnes over 12 years
    I'm not able to reproduce, I've not used nodester before though.
  • Eric
    Eric over 12 years
    So you can connect to my database without a problem running from your own machine? Thanks for checking for me. (have an upvote).
  • Dominic Barnes
    Dominic Barnes over 12 years
    Yeah, I get the expected "Info!" message at the end and everything.
  • dscape
    dscape over 12 years
    Cradle has been mostly inactive for several months, with just maintenence updates from the nodejitu team.
  • yojimbo87
    yojimbo87 over 12 years
    @dscape: At the time of writing my answer it was the most popular and active module. You can edit it if you want and add your nano library first.
  • dscape
    dscape about 12 years
    I didnt remove but added the edit. i think that makes more sense
  • Tomo
    Tomo almost 10 years
    thanks for "querystring" module suggestion. request is by far most robust and easy library to work with
  • Michael Cole
    Michael Cole about 9 years
    Yes, when getting started, the first thing I like to do is rewrite code that's already been written and tested. Wait, I don't like that.
  • JasonSmith
    JasonSmith about 9 years
    Sarcasm is not helpful. This answer is nearly four years old; although I still stand by it, because the point of the answer is that CouchDB is so simple, use a written, well-tested HTTP library, rather than a CouchDB one. But I also use and recommend Nano as well. It is a wonderful example of a lightweight library, with usefulness without getting in the way.
  • JasonSmith
    JasonSmith about 9 years
    That's right. You got it.
  • Migol
    Migol over 8 years
    @JasonSmith your answer teaches some of the worst programmer practices by assuming that code made by one person will be less prone to bugs than module used a lot by different people which source have been bugfixed over a long period of time.

Related