mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
// This file was added by layer0 init.
|
|
// You should commit this file to source control.
|
|
|
|
const { Router } = require('@layer0/core/router')
|
|
const { nuxtRoutes } = require('@layer0/nuxt')
|
|
|
|
module.exports = new Router()
|
|
.match('/service-worker.js', ({ serviceWorker }) => {
|
|
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)
|