mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Try Nuxt ISR
This commit is contained in:
parent
7165f4db3c
commit
39a8a67f2f
1 changed files with 15 additions and 0 deletions
15
routes.js
15
routes.js
|
|
@ -8,4 +8,19 @@ module.exports = new Router()
|
||||||
.match('/service-worker.js', ({ serviceWorker }) => {
|
.match('/service-worker.js', ({ serviceWorker }) => {
|
||||||
serviceWorker('.nuxt/dist/client/service-worker.js')
|
serviceWorker('.nuxt/dist/client/service-worker.js')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Nuxt ISR
|
||||||
|
// https://docs.layer0.co/guides/nuxt#section_incremental_static_rendering__isg_
|
||||||
|
.get('/app/:id', ({ cache }) => {
|
||||||
|
cache({
|
||||||
|
edge: {
|
||||||
|
// Requests for product pages that are not statically generated will fall back to SSR.
|
||||||
|
// The first user will see the 200.html loading page generated by Nuxt.
|
||||||
|
// Layer0 will render full HTML response in the background and cache it for one hour at the edge.
|
||||||
|
// All future requests to the page will result in the full HTML response.
|
||||||
|
maxAgeSeconds: 60 * 60 * 24,
|
||||||
|
staleWhileRevalidateSeconds: 60 * 60, // continue to serve stale responses from the edge cache while refreshing via SSR in the background
|
||||||
|
},
|
||||||
|
})
|
||||||
|
})
|
||||||
.use(nuxtRoutes)
|
.use(nuxtRoutes)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue