I am trying to connect to my CouchDB database on Cloudant using Node.js.
This worked on the shell:
curl https://weng:[email protected]/my_app/_all_docs
But this node.js code didn't work:
var couchdb = http.createClient(443, 'weng:[email protected]', true);
var request = couchdb.request('GET', '/my_app/_all_docs', {
'Host': 'weng.cloudant.com'
});
request.end();
request.on('response', function (response) {
response.on('data', function (data) {
util.print(data);
});
});
It gave me this data back:
{"error":"unauthorized","reason":"_reader access is required for this request"}
How do I do to list all my databases with Node.js?