Best way to use Cradle with Express.js (CouchDB, Node.js)
- by Costa
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!!!