From d229174bed1887d95f37c7aa24b98389b40bd670 Mon Sep 17 00:00:00 2001 From: terminaldweller Date: Sun, 11 Apr 2021 15:18:54 +0430 Subject: added caching --- package-lock.json | 13 ++++++++++++- server.js | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 923abfa..c79e271 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,8 @@ "markdown-it": "^11.0.0", "markdown-it-highlightjs": "^3.4.0", "markdown-it-multimd-table": "^4.0.2", - "markdown-it-texmath": "^0.7.0" + "markdown-it-texmath": "^0.7.0", + "memory-cache": "^0.2.0" } }, "node_modules/abab": { @@ -977,6 +978,11 @@ "node": ">= 0.6" } }, + "node_modules/memory-cache": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/memory-cache/-/memory-cache-0.2.0.tgz", + "integrity": "sha1-eJCwHVLADI68nVM+H46xfjA0hxo=" + }, "node_modules/merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", @@ -2410,6 +2416,11 @@ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" }, + "memory-cache": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/memory-cache/-/memory-cache-0.2.0.tgz", + "integrity": "sha1-eJCwHVLADI68nVM+H46xfjA0hxo=" + }, "merge-descriptors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", diff --git a/server.js b/server.js index 86681e9..8ebab87 100755 --- a/server.js +++ b/server.js @@ -32,6 +32,7 @@ app.get("/$", (req, res) => { ); readStream.on("data", (chunk) => { res.render("index", { + cache: true, data: { blogHttp: mit.render(chunk), mds: fs.readdirSync(path.join(__dirname, "mds"), "utf-8"), @@ -51,6 +52,7 @@ app.get("/mds/:mdname$", (req, res) => { ); readStream.on("data", (chunk) => { res.render("index", { + cache: true, data: { blogHttp: mit.render(chunk), mds: fs.readdirSync(path.join(__dirname, "mds"), "utf-8"), -- cgit v1.2.3