2 Drive dev set up

52 views
Skip to first unread message

Arangogo

unread,
May 31, 2017, 3:05:14 PM5/31/17
to ArangoDB
Hi,


Running ArangoDB with Web Interface Community Edition on two separate drives without Foxx

C: Windows 10 with ArangoDB WUI as in C:\Program Files\ArangoDB3 3.1.21

H: all files html, js + all data processed within ArangoDB


What is the best way to link html/js editor files (in H) to ArangoDB WUI (in C) so that we can actually see query results in the browser ?

If a router is needed in the index .html and .js files what path from and to ArangoDB ?


At the moment ArangoDB WUI runs from C drive but ultimately all data is to be stored in H drive (not Windows main drive)

How can we manage this double drive set up to run together ?


Thx

Wilfried Gösgens

unread,
Jun 1, 2017, 3:58:41 AM6/1/17
to ArangoDB
Hi,
You most probably want to set up the

[javascript]
startup-directory = ./js
app-path = ./js/apps

in the etc/arangodb3/arangod.conf so they contain absolute paths to their desired location.

to point to the other drive.
However, the installer doesn't have a way to extract files there - maybe the zip could be the best way for you to achieve that.

Cheers,
Willi
Message has been deleted
Message has been deleted
Message has been deleted

Arangogo

unread,
Jun 1, 2017, 3:08:29 PM6/1/17
to ArangoDB

Now keeping all DB files in drive C without Foxx

How to load collection Objects from ArangoDB _System database in the main html file to be able to run simple queries directly onto the browser ?


As an example written in pseudo code :

<script>

CONNECT TO ArangoDB


LOAD _System


FOR O in Objects

RETURN O


</script>

How can we make this script to work ?


Wilfried Gösgens

unread,
Jun 2, 2017, 5:56:19 AM6/2/17
to ArangoDB
Short answer:
  you don't.
Long answer:
 From a security perspective its not a good idea at all to directly send database queries to your backend. A possible attacker will be able to send his own requests - see https://xkcd.com/327/ for more details.
 Foxx is whats made therefore. You send your query criterias to your foxx service, which does propper input validation and then does the query for you in term.
 you use https://docs.arangodb.com/3.1/Manual/Foxx/Router/ to move browsers from simple to reach locations into your service.

Arangogo

unread,
Jun 2, 2017, 10:33:17 AM6/2/17
to ArangoDB


Alright, so we need to wrap up our query in a function as in :


const aql = require('@arangodb').aql;

router.get('/entries', function (req, res) {
  const keys = db._query(aql`
    FOR entry IN ${foxxColl}
    RETURN entry._key
  `);
  res.send(keys);
})
.response(joi.array().items(
  joi.string().required()
).required(), 'List of entry keys.')
.summary('List entry keys')
.description('Assembles a list of keys of entries in the collection.');

Why do we need to joi filter the output ?


Also could you explain this syntax


`Hello ${req.pathParams.name}`

from

const joi = require('joi');

router.get('/hello/:name', function (req, res) {
  res.send(`Hello ${req.pathParams.name}`);
})

$ in this too :

 
${foxxColl}






Alan Plum

unread,
Jun 2, 2017, 10:46:26 AM6/2/17
to ArangoDB
Hi,

you don't need to use joi in that case if you don't want it.

The `response` method is documented here:


> the actual schema will not be used to validate the response body and only serves to document the response in more detail in the API documentation

The template string syntax is a recent addition to the JavaScript language (introduced in ECMAScript 2015, also called ES6);


Cheers,

Alan
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages