Dont cache /api/**

Hi there, Im trying to cache all pages except the api routes. Does someone know how i can do this? My current routeRules:
{
"/api/**": {
swr: true,
},
"/**": {
cache: {
maxAge: 60 * 60 * 24,
},
},
}
{
"/api/**": {
swr: true,
},
"/**": {
cache: {
maxAge: 60 * 60 * 24,
},
},
}
I found this discussion: https://github.com/nuxt/nuxt/discussions/16048 but that does not solve it sadly.
GitHub
Route Rules - How to use / except /api/ routes? · nuxt nuxt · D...
I'm trying to essentially setup the following route rules whereby it doesn't statically render any API routes, but does statically render everything else. Unfortunately I'm running into...
2 Replies
Cue
Cue3mo ago
Have you tried switching the rules i.e. /** is first?
RicharDVD
RicharDVD3mo ago
Not sure what the issue is? SWR is caching the API and revalidates in the background. If you don't want to cache it, I think you can just use
cache: false
cache: false
Want results from more Discord servers?
Add your server