1
0
Fork 0

Document require behaviour in migration

Fixes #1694.
[skip ci]
This commit is contained in:
Alan Plum 2016-06-17 16:16:34 +02:00
parent a9af4559da
commit 84a05ebc38
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
1 changed files with 32 additions and 0 deletions

View File

@ -6,6 +6,38 @@ This chapter outlines the major differences in the Foxx API between ArangoDB 2.8
Additionally please note the differences laid out in the section titled ["Incompatibilities with 2.8 and earlier"](LegacyMode.md#incompatibilities-with-28-and-earlier) in the chapter covering the legacy compatibility mode.
!SECTION Migrating from pre-2.8
When migrating from a version older than ArangoDB 2.8 please note that starting with ArangoDB 2.8 the behaviour of the `require` function more closely mimics the behaviour observed in Node.js and module bundlers for browsers, e.g.:
In a file `/routes/examples.js` (relative to the root folder of the service):
* `require('./my-module')` will be attempted to be resolved in the following order:
1. `/routes/my-module` (relative to service root)
2. `/routes/my-module.js` (relative to service root)
3. `/routes/my-module.json` (relative to service root)
4. `/routes/my-module/index.js` (relative to service root)
5. `/routes/my-module/index.json` (relative to service root)
* `require('lodash')` will be attempted to be resolved in the following order:
1. `/routes/node_modules/lodash` (relative to service root)
2. `/node_modules/lodash` (relative to service root)
3. ArangoDB module `lodash`
4. Node compatibility module `lodash`
5. Bundled NPM module `lodash`
* `require('/abs/path')` will be attempted to be resolved in the following order:
1. `/abs/path` (relative to file system root)
2. `/abs/path.js` (relative to file system root)
3. `/abs/path.json` (relative to file system root)
4. `/abs/path/index.js` (relative to file system root)
5. `/abs/path/index.json` (relative to file system root)
This behaviour is incompatible with the source code generated by the Foxx generator in the web interface before ArangoDB 2.8.
!SECTION Manifest
Many of the fields that were required in ArangoDB 2.x are now optional and can be safely omitted.