Skip to content

Instantly share code, notes, and snippets.

@atinux
Created April 21, 2023 10:55
Show Gist options
  • Save atinux/c8a2c06ac4fa9518ff013db40b2a59a0 to your computer and use it in GitHub Desktop.
Save atinux/c8a2c06ac4fa9518ff013db40b2a59a0 to your computer and use it in GitHub Desktop.

Revisions

  1. atinux created this gist Apr 21, 2023.
    16 changes: 16 additions & 0 deletions nuxt.config.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    export default defineNuxtConfig({
    routeRules: {
    // Homepage pre-rendered at build time
    '/': { prerender: true },
    // Product page generated on-demand, revalidates in background
    '/products/**': { swr: true },
    // Blog post generated on-demand once until next deploy
    '/blog/**': { isr: true },
    // Admin dashboard renders only on client-side
    '/admin/**': { ssr: false },
    // Add cors headers on API routes
    '/api/**': { cors: true },
    // Redirects legacy urls
    '/old-page': { redirect: '/new-page' }
    }
    })