Add cache parameter
This commit is contained in:
Generated
+9
@@ -27,6 +27,7 @@
|
|||||||
"handlebars": "4.7.8",
|
"handlebars": "4.7.8",
|
||||||
"http-shutdown": "1.2.2",
|
"http-shutdown": "1.2.2",
|
||||||
"morgan": "1.10.0",
|
"morgan": "1.10.0",
|
||||||
|
"nocache": "^4.0.0",
|
||||||
"pbf": "3.2.1",
|
"pbf": "3.2.1",
|
||||||
"proj4": "2.9.0",
|
"proj4": "2.9.0",
|
||||||
"request": "2.88.2",
|
"request": "2.88.2",
|
||||||
@@ -5943,6 +5944,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
|
||||||
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
|
"integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/nocache": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/nocache/-/nocache-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-AntnTbmKZvNYIsTVPPwv7dfZdAfo/6H/2ZlZACK66NAOQtIApxkB/6pf/c+s+ACW8vemGJzUCyVTssrzNUK6yQ==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/node-abi": {
|
"node_modules/node-abi": {
|
||||||
"version": "3.31.0",
|
"version": "3.31.0",
|
||||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.31.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.31.0.tgz",
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"handlebars": "4.7.8",
|
"handlebars": "4.7.8",
|
||||||
"http-shutdown": "1.2.2",
|
"http-shutdown": "1.2.2",
|
||||||
"morgan": "1.10.0",
|
"morgan": "1.10.0",
|
||||||
|
"nocache": "^4.0.0",
|
||||||
"pbf": "3.2.1",
|
"pbf": "3.2.1",
|
||||||
"proj4": "2.9.0",
|
"proj4": "2.9.0",
|
||||||
"request": "2.88.2",
|
"request": "2.88.2",
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import { serve_font } from './serve_font.js';
|
|||||||
import { getTileUrls, getPublicUrl } from './utils.js';
|
import { getTileUrls, getPublicUrl } from './utils.js';
|
||||||
|
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
import nocache from 'nocache';
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
const packageJson = JSON.parse(
|
const packageJson = JSON.parse(
|
||||||
@@ -83,6 +84,13 @@ function start(opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const options = config.options || {};
|
const options = config.options || {};
|
||||||
|
|
||||||
|
const cacheFlag = options.cache || false;
|
||||||
|
if (!cacheFlag) {
|
||||||
|
console.log('Cache disabled');
|
||||||
|
app.use(nocache());
|
||||||
|
}
|
||||||
|
|
||||||
const paths = options.paths || {};
|
const paths = options.paths || {};
|
||||||
options.paths = paths;
|
options.paths = paths;
|
||||||
paths.root = path.resolve(
|
paths.root = path.resolve(
|
||||||
|
|||||||
Reference in New Issue
Block a user