I am new to backend service. I have been trying to make a connection to arangodb from node server. I have a created a basic query in arangodb. the user auth in arangodb is so complicated and there are very few tutorials for node and arangadb combo. I have posted my code below. I have found this example online.
DataService.js
var arangojs = require('arangojs');
// Const variables for connecting to ArangoDB database
const host = '192.100.00.000'
const port = '8529'
const username = 'abcde'
const password = 'abcde'
const path = '/_db/_system/_api/'
const databasename = 'xyzm_app'
// Connection to ArangoDB
var db = new arangojs.Database({
url: `http://${host}:${port}${path}${databasename}`,
databaseName: databasename
});
db.useBasicAuth(username, password);
//console.log(db);
module.exports = {
getAllControllers : function(){
return db.query('For x IN {user_details} RETURN NEW {
id: x._user_details/7977010,
name: x.char_ctrl_username,
email:x.char_ctrl_email
}')
.then(cursor => {
return cursor.all()
});
}
query in db

http://${username}:${password}@${host}:${port}, databaseName: databasename});