i am trying to use cradle to connect couchdb my code is as below:
var cradle = require('cradle');
//grab the packages we need
var c = new(cradle.Connection)('username:password@127.0.0.1',5984);
var express = require ('express');
var app = express();
var port = process.env.PORT || 6008;
var bodyParser = require('body-parser');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended: true}));
app.post('/cradle/create', function(req, res) {
var name = req.body.name;
var db = c.database(name);
db.create(function(err){
console.log("ERROR :-(");
console.log(err);
});
});
//start the server
app.listen(port);
console.log("server Started on : http://localhost:" + port);
and i am getting this error message displayed in terminal:
{ Error: getaddrinfo ENOTFOUND username:password@127.0.0.1 username:password@127.0.0.1:5984
at errnoException (dns.js:28:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:73:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'username:password@127.0.0.1',
host: 'username:password@127.0.0.1 ',
port: 5984 }
i have tried using nano it works but have some issues now i need to use cradle instead of nano
via Nasiruddin Saiyed
No comments:
Post a Comment