I am new to arangodb and node. I could be able to connect to the database from node server and successfully able to receive queries or id from collections and even edge collections. All these were done simply by directly running the server.js file.
Now I would like to create function in node.js to able to receive the data from Arangodb for each individual task so that I can use this with the front end (Angular4) later. I have attached my server.js file. Can anyone suggest how to do it?
// BASE SETUP
// ## Assigning the values
const arangojs = require('arangojs');
const aqlQuery = arangojs.aqlQuery;
const now = Date.now();
// ## Const variables for connecting to ArangoDB database
const host = '192.000.00.000'
const port = '8529'
const username = 'xyz'
const password = 'xyz'
const path = '/_db/sgcdm_app/_api/'
const database = 'sgcdm_app'
// ## Connection to ArangoDB
db = new arangojs.Database({
url: http://${host}:${port},
databaseName: database
});
db.useBasicAuth(username, password);
const collection = db.edgeCollection('included_in');
const edge = collection.edge('included_in/595783');
//============
//## call the packages we need
var express = require('express'); // call express
var app = express(); // define our app using express
var bodyParser = require('body-parser');
//## configure app to use bodyParser()------//
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
var port1 = process.env.PORT || 8080; // set our port
// START THE SERVER
app.listen(port1);
console.log('Magic happens on port1 ' + port1);