felixge/node-couchdb

using cloudant for storage

shripadk opened this issue · 4 comments

i am using cloudant for storage. missing feature: https requests using httpClient in node-couchdb?

i would want to do something on the lines of :

var express   = require('express'),
    couchdb   = require('couchdb');

var app    = express.createServer(),
    couch  = couchdb.createClient(443, "username.cloudant.com", "username", "password");

var db  = couch.db('database');
app.get('/', function(req, res) {
        db.getDoc('doc', function(err, doc) {
            res.send(doc);
        })
});

app.listen(3000);

since this commit as soon as you set the port to 443 ssl will be used automatically

Does not seem to work for me:

node.js:63
throw e;
^
Error: ECONNRESET, Connection reset by peer
at Client._readImpl (net:304:14)
at IOWatcher.callback (net:454:24)
at node.js:769:9

Sorry to let you know, but I have decided to no longer maintain this module. The main reason is that I currently don't have any active project involving couchdb whatsoever, so maintaining this module has become an unmanageable burden. That being said, if somebody is interested in becoming the maintainer, let me know.

Line 112 needs to pass true for the third argument to create an SSL connection:

   var
-    httpClient = http.createClient(port, host),
+    httpClient = http.createClient(port, host, port == 443),
     couchClient = new Client();

The changesStream() function already does this.