diff --git a/js/apps/system/_admin/aardvark/APP/aardvark.js b/js/apps/system/_admin/aardvark/APP/aardvark.js index 93fb9430d0..2b3652454a 100644 --- a/js/apps/system/_admin/aardvark/APP/aardvark.js +++ b/js/apps/system/_admin/aardvark/APP/aardvark.js @@ -132,7 +132,7 @@ controller.allRoutes controller.apiDocumentation('/api', { swaggerJson(req, res) { - var filename = applicationContext.foxxFilename('api-docs.json'); + var filename = applicationContext.fileName('api-docs.json'); res.sendFile(filename, {lastModified: true}); } }); diff --git a/js/server/modules/@arangodb/foxx/base_middleware.js b/js/server/modules/@arangodb/foxx/base_middleware.js index 266954b63d..897ad5d3f0 100644 --- a/js/server/modules/@arangodb/foxx/base_middleware.js +++ b/js/server/modules/@arangodb/foxx/base_middleware.js @@ -382,7 +382,7 @@ function BaseMiddleware() { /// /// ```js /// response.sendFile('/tmp/results.json'); -/// response.sendFile(applicationContext.foxxFilename('image.png'), { lastModified: true }); +/// response.sendFile(applicationContext.fileName('image.png'), { lastModified: true }); /// ``` /// @endDocuBlock //////////////////////////////////////////////////////////////////////////////// diff --git a/js/server/modules/@arangodb/foxx/service.js b/js/server/modules/@arangodb/foxx/service.js index 2f72de497e..4a775cc000 100644 --- a/js/server/modules/@arangodb/foxx/service.js +++ b/js/server/modules/@arangodb/foxx/service.js @@ -25,10 +25,18 @@ class AppContext { }); } - foxxFilename(filename) { + fileName(filename) { return fs.safeJoin(this._prefix, filename); } + file(filename, encoding) { + return fs.readFileSync(this.fileName(filename), encoding); + } + + foxxFilename(filename) { + return this.fileName(filename); + } + path(name) { return path.join(this._prefix, name); }