Best way to use Cradle with Express.js (CouchDB, Node.js)

Posted by Costa on Stack Overflow See other posts from Stack Overflow or by Costa
Published on 2012-06-15T23:42:37Z Indexed on 2012/06/16 15:16 UTC
Read the original article Hit count: 141

Filed under:
|
|
|

I'm building my website ( http://tedxgramercy.jit.su ) with express.js and so far I've been using the http.request method in node to access couch, and that's been cool. I've learned lots about how http, couch, and node work, which is awesome. Anyways, I'm thinking of moving over to cradle now (Let me know if you have a strong opinion about this) and I'd like to know the "right" way to set this up.

Should I...

require() cradle and make a new connection to my db in each separate route?

create my database connection once, and then just pass that connection by require()ing the connection in each route? (if so, how do I do that?)

Thanks!!!

© Stack Overflow or respective owner

Related posts about node.js

Related posts about couchdb