N
Nuxt3mo ago
djmtype

Prerender RouteRules clarification

If I prender my api endpoint then build, and then start my dev server again, will it reference from the .output directory or make a new request from the source API?
nitro: {
routeRules: {
'/api/spotify/**': { prerender: true },
}
}
nitro: {
routeRules: {
'/api/spotify/**': { prerender: true },
}
}
I basically don't want or need to make any new requests during a development session because I'm fetching a bunch of data at once, and it will lead to a 429.
1 Reply
djmtype
djmtype3mo ago
My nuxt config:
// nuxt config
nitro: {
routeRules: {
'/api/spotify/**': { static: true },
}
}
// nuxt config
nitro: {
routeRules: {
'/api/spotify/**': { static: true },
}
}
Does that conflict with my /server/api/spotify/[page].js if I use defineCachedEventHandler()? If so, what takes precedence?
// server/api/[page].js
export default defineCachedEventHandler(async (event) => {
// $fetch stuff
}, { maxAge: 60 * 60 })
// server/api/[page].js
export default defineCachedEventHandler(async (event) => {
// $fetch stuff
}, { maxAge: 60 * 60 })
Want results from more Discord servers?
Add your server