stackdave stackdave - 9 days ago 5
Javascript Question

couchdb , use middleware or not ? wich for simple restful api, with express4 nodejs

I dont find a lot of examples about couchdb with nodejs and express4.

I've seen there are on npm:

- https://www.npmjs.com/package/node-couchdb
- https://www.npmjs.com/package/nano


they are compatible with couchdb 2?

or there is a way to work without middleware? in this case it's better to work without middleware to understand better how works couchdb? i'd like to read some examples about that.

Answer

Well, the documentation of PouchDB is absolutely awesome. You have a bigger community(in my opinion) around PouchDB and it's constantly evolving. If it's not fully compatible with CouchDB 2.0, it will be very soon. They are also already implementing the Mango Query.

Nano is very minimalist compared to PouchDB.Everything depends on your needs. Also, PouchDB offers you the possibility to use Promises which make it easier to write clean code compared to nano callbacks.

Nano and PouchDB are good libraries and I highly suggest that you start using one of those libraries. Unless you want to build something very different from those, building your own library would be a waste of time. You might want to focus more on the core of your project than building an library to access CouchDB's API.