This is a middleware to set up the couchdb connection.