Commit 08171b06 authored by Pooya Parsa's avatar Pooya Parsa

perf: server side cache for api calls

parent 39853f54
import express from "express"
import apicache from "apicache"
const app = express()
// https://github.com/kwhitley/apicache
app.use(apicache.middleware("5 minutes"))
// apicache.options({ debug: true })
export default {
path: "/api/",
handler: app
}
module.exports = {
export default {
head: {
titleTemplate: "Nuxt HN | %s",
meta: [
......@@ -36,6 +36,7 @@ module.exports = {
}
},
plugins: ["~/plugins/filters"],
serverMiddleware: ["~/common/cache.js"],
render: {
static: {
maxAge: "1y",
......
......@@ -35,6 +35,8 @@
"@nuxtjs/axios": "^5.1.1",
"@nuxtjs/component-cache": "^1.1.1",
"@nuxtjs/pwa": "2.0.8",
"apicache": "^1.2.1",
"express": "^4.16.3",
"nuxt-edge": "^2.0.0-25364965.06067bf",
"vue-server-renderer": "^2.5.16"
},
......
......@@ -271,6 +271,10 @@ anymatch@^2.0.0:
micromatch "^3.1.4"
normalize-path "^2.1.1"
apicache@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/apicache/-/apicache-1.2.1.tgz#765cec58aae5f48a9c71007d035f4110aa6fbeaf"
aproba@^1.0.3, aproba@^1.1.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a"
......@@ -2368,7 +2372,7 @@ expand-range@^1.8.1:
dependencies:
fill-range "^2.1.0"
express@^4.16.2:
express@^4.16.2, express@^4.16.3:
version "4.16.3"
resolved "https://registry.yarnpkg.com/express/-/express-4.16.3.tgz#6af8a502350db3246ecc4becf6b5a34d22f7ed53"
dependencies:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment