I'm trying to connect to arangodb3 using Nodejs 7.5.0 with unix file socket on Gentoo Linux.
I started arrangodb3 server with a unix socket at /tmp/mysocket.
I tried two different modules:
const arangojs = require('arangojs');
let db = arangojs({
url: `unix:///tmp/mysocket`,
databaseName: false // don't automatically append database path to URL
});
db.createDatabase('mydb', function (err, info) {
if (err) console.error(err.stack);
else {
console.info('database created');
// database created
}
});
which gives me:
Error: connect ECONNREFUSED ::1:80
at Object.exports._errnoException (util.js:1023:11)
at exports._exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
so it tries to connect to localhost port 80, ignores my unix socket file location
I also tried:
var arango = require('arango');
var db = arango.Connection("unix:///tmp/mysocket");
db.collection.list().done(function(res){
console.log("collections: %j", res);
});
which gives me:
Error: Cannot find module 'unix'
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._load (module.js:418:25)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Xhr (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/xhr.js:23:12)
at Arango.request (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/arango.js:166:2)
at Arango.(anonymous function) [as get] (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/arango.js:204:14)
at Object.list (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/api/collection/index.js:125:16)
at Object.instance.(anonymous function) [as list] (/home/ufk/work-projects/bingo/arrango/node_modules/arango/lib/api/api.js:121:25)
at Object.<anonymous> (/home/ufk/work-projects/bingo/arrango/index2.js:5:16)
I don't really care which module to use.. just looking for something that supports unix file sockets. any ideas ?
I opened a bug report on arrangojs regarding lack support of unix file socket. they responded that it's not supported. that unix://
is not supported yet but nodejs's http.request
support socketPath
parameter.