Related modules
These are some of the modules outside of Foxx you will find useful whenwriting Foxx services.
Additionally there are modules providing some level of compatibility withNode.js as well as a number of bundled NPM modules (like lodash and joi).For more information on these modules seethe JavaScript modules appendix.
The @arangodb module
require('@arangodb')
This module provides access to various ArangoDB internals as well as three ofthe most important exports necessary to work with the database in Foxx:db
, aql
and errors
.
You can find a full description of this module in theArangoDB module appendix.
The @arangodb/locals module
require('@arangodb/locals')
This module provides a context
object which is identical to theservice context of whichever module requires it.
There is no advantage to using this module over the module.context
variabledirectly unless you’re using a tool like Webpackto translate your code and can’t use the module
object Foxx provides directly.
The @arangodb/request module
require('@arangodb/request')
This module provides a function for making HTTP requests to external services.Note that while this allows communicating with third-party services it mayaffect database performance by blocking Foxx requests as ArangoDB waits forthe remote service to respond. If you routinely make requests to slow externalservices and are not directly interested in the response it is probably abetter idea to delegate the actual request/response cycle to a gateway servicerunning outside ArangoDB.
You can find a full description of this module in therequest module appendix.
The @arangodb/general-graph module
require('@arangodb/general-graph')
This module provides access to ArangoDB graph definitions and various low-levelgraph operations in JavaScript. For more complex queries it is probably betterto use AQL but this module can be useful in your setup and teardown scripts tocreate and destroy graph definitions.
For more information see the chapter on thegeneral graph module.