Add cache parameter

This commit is contained in:
Ivan Vazhenin
2023-11-30 16:16:12 +03:00
parent 61e830901b
commit f94d6d3253
3 changed files with 18 additions and 0 deletions
+8
View File
@@ -22,6 +22,7 @@ import { serve_font } from './serve_font.js';
import { getTileUrls, getPublicUrl } from './utils.js';
import { fileURLToPath } from 'url';
import nocache from 'nocache';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const packageJson = JSON.parse(
@@ -83,6 +84,13 @@ function start(opts) {
}
const options = config.options || {};
const cacheFlag = options.cache || false;
if (!cacheFlag) {
console.log('Cache disabled');
app.use(nocache());
}
const paths = options.paths || {};
options.paths = paths;
paths.root = path.resolve(