cmcnicholas
Prerender Ignore Wildcard Path
I have a static nuxt site that uses environment variables that are tokenised into the application during build. On deployment we replace these tokens resulting in no rebuild on deploy.
The tokens look like:
__VITE_SOMETHING__
, they are used for some links on the site. During static build nuxt will traverse these and I get:
I have tried:
1. Marking NuxtLink
's as external
2. Adding to my routeRules
the following:
But neither seem to work.
Is there a way to tell nuxt to ignore a wildcarded path during static compile?9 replies
Invoke `/api` endpoint from another `/api` endpoint
I have some shared data that can be requested from
/api/items
using defineCachedEventHandler
which works great.
I have another call /api/items/<some-id>
again using defineCachedEventHandler
where I could fetch individually from my backend but the number of items is stable at ~200-300. I get the list of these in 1-2 api calls and after doing so my cache is warm.
What I want to do is:
/api/items/xxx
-> calls /api/items
to fetch the item as I am confident that 99.99% of the calls will already have a populated cache and if not this action would populate said cache.
Is there a way to have nuxt server methods invoke each other but not over http request as this is just expensive and wasteful?
Otherwise I will most likely create a singleton in the service to store these items and both endpoints in /api
will just invoke that but was hoping Nuxt and its defineCachedEventHandler
could take care of this for me and I can just invoke one from another.1 replies