Getting CouchDB to work with node.js
Asked Answered
I

1

2

I'm using nodester with iriscouch. I've installed the couchdb-api package. This is my code:

console.log("Running");
//Appears in the logs

var dbServer = require("couchdb-api").srv('eric-wieser.iriscouch.com');
console.log(dbServer);
//Appears in the logs

dbServer.info(function (err, response) {
    console.log("Info!");

    //Never executed. Logs show:
    //Error: ECONNREFUSED, Could not contact DNS servers
    //    at IOWatcher.callback (dns.js:74:15)
});

Why is this not working? What is that error trying to tell me?

Ijssel answered 5/9, 2011 at 20:2 Comment(4)
Running on nodester. So I'm assuming Linux, since their cli is for linux. I don't actually know though.Ijssel
It seems there is a problem with the DNS server. I would have added nameserver 8.8.8.8 in /etc/resolv.conf, but i doubt you can change that on nodester :(Elephant
@stewe: So should it work with just an IP address?Ijssel
Yes, using an ip solves the DNS problem, but it requires you to modify the HTTP Host Header to eric-wieser.iriscouch.com, so that iriscouch knows to which iriscouch-user to direct the request. Or else you would just see: 50.16.186.4Elephant
A
3

Can't help you with nodester, have no experience with it. However that seems to indicate you cannot connected to iriscouch, which might mean you need to give the full url? Does the code work on your local machine?

If you are interested I wrote a blog for couchdb/node beginners yesterday: http://writings.nunojob.com/2011/09/getting-started-with-nodejs-and-couchdb.html

Ascendancy answered 5/9, 2011 at 20:55 Comment(3)
I don't have node.js installed on my local machine - I don't have admininstrator access - so there's no easy way for me to test it. I tried initially with a full URL, but the documentation said it needed a hostname.Ijssel
Have you tried following this tutorial I posted? did you get the same problem? Don't forget to install all dependencies by hand since nodester does not seem to do that for youAscendancy
@Eric, You don't need to be an administrator to install nodejs for your account. If you don't have build dependencies installed (python, make, g++, ...) it is difficult, but otherwise it is quite easy.Lodi

© 2022 - 2024 — McMap. All rights reserved.