1
0
Fork 0

applicationContext.foxxFilename -> applicationContext.fileName

This commit is contained in:
Alan Plum 2015-12-16 01:57:04 +01:00
parent 8b05198e17
commit b61d08efce
3 changed files with 11 additions and 3 deletions

View File

@ -132,7 +132,7 @@ controller.allRoutes
controller.apiDocumentation('/api', { controller.apiDocumentation('/api', {
swaggerJson(req, res) { swaggerJson(req, res) {
var filename = applicationContext.foxxFilename('api-docs.json'); var filename = applicationContext.fileName('api-docs.json');
res.sendFile(filename, {lastModified: true}); res.sendFile(filename, {lastModified: true});
} }
}); });

View File

@ -382,7 +382,7 @@ function BaseMiddleware() {
/// ///
/// ```js /// ```js
/// response.sendFile('/tmp/results.json'); /// response.sendFile('/tmp/results.json');
/// response.sendFile(applicationContext.foxxFilename('image.png'), { lastModified: true }); /// response.sendFile(applicationContext.fileName('image.png'), { lastModified: true });
/// ``` /// ```
/// @endDocuBlock /// @endDocuBlock
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -25,10 +25,18 @@ class AppContext {
}); });
} }
foxxFilename(filename) { fileName(filename) {
return fs.safeJoin(this._prefix, 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) { path(name) {
return path.join(this._prefix, name); return path.join(this._prefix, name);
} }