CouchDB and Node.js - What module do you recommend?
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.
Related videos on Youtube
cllpse
Designing and developing websites and app's for close to two decades.
Updated on July 05, 2022Comments
-
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 about 13 yearsGood advice. I've actually done a JavaScript wrapper for CouchDB, though :)
-
JasonSmith almost 13 yearsWhile 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 over 12 yearsI'm having some problems with that. Can you try to reproduce it on your machine?
-
Dominic Barnes over 12 yearsI'm not able to reproduce, I've not used nodester before though.
-
Eric over 12 yearsSo you can connect to my database without a problem running from your own machine? Thanks for checking for me. (have an upvote).
-
Dominic Barnes over 12 yearsYeah, I get the expected "Info!" message at the end and everything.
-
dscape over 12 yearsCradle has been mostly inactive for several months, with just maintenence updates from the nodejitu team.
-
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 about 12 yearsI didnt remove but added the edit. i think that makes more sense
-
Tomo almost 10 yearsthanks for "querystring" module suggestion. request is by far most robust and easy library to work with
-
Michael Cole about 9 yearsYes, 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 about 9 yearsSarcasm 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 about 9 yearsThat's right. You got it.
-
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.