Beginner Question.
Below is an example given on the Cradle CouchDB documentation:
https://github.com/cloudhead/cradle
What is http://living-room.couch?
What is 5984?
new(cradle.Connection)('http://living-room.couch', 5984, {
cache: true,
raw: false
});
I’m trying to get info from my couchdb:
url: subdomain.mywebsite.com
node port: 12345
couchdb port: 67891
I’ve tried different ways to connect using the above code, but I get the below error.
What is the right way to connect?
17 May 09:50:57 - [nodemon] restarting due to changes...
17 May 09:50:57 - [nodemon] ./test_couch.js
17 May 09:50:57 - [nodemon] starting node
Server running somewhere
request starting...
request starting...
node.js:181
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: ECONNREFUSED, Connection refused
at Socket._onConnect (net.js:602:18)
at IOWatcher.onWritable [as callback] (net.js:186:12)
17 May 09:51:05 - [nodemon] app crashed - waiting for file change before starting...
From the same documentation that you posted a link to, but only in the code folder here in this JS file https://github.com/cloudhead/cradle/blob/master/lib/cradle.js
So it takes whatever parameters you give it, and slices it into an array.
It’s the port to connect to, as evinced by this code snippet I shared.
It accepts really three types of parameters, a port (between 2 and 5 digits in length) number, a string, and an object for configuration.
You could supply just one object and declare the parts of it as this:
and it would work the same