🧹 Nuxt revalidate module
- Add
nuxt-revalidate
dependency to your project
# Using pnpm
pnpm add -D nuxt-revalidate
# Using yarn
yarn add --dev nuxt-revalidate
# Using npm
npm install --save-dev nuxt-revalidate
- Add
nuxt-revalidate
to themodules
section ofnuxt.config.ts
export default defineNuxtConfig({
modules: [
'nuxt-revalidate'
]
})
- Protect
/__revalidate__
endpoint using secret key in.env
ornuxt.config.ts
REVALIDATE_KEY=YOUR_SECRET_KEY
export default defineNuxtConfig({
revalidate: {
key: 'YOUR_SECRET_KEY'
}
});
That's it! You can now call /__revalidate__?path=ROUTE_TO_REVALIDATE&key=YOUR_SECRET_KEY
and clear cached route.
# Install dependencies
npm install
# Generate type stubs
npm run dev:prepare
# Develop with the playground
npm run dev
# Build the playground
npm run dev:build
# Run ESLint
npm run lint
# Run Vitest
npm run test
npm run test:watch
# Release new version
npm run release