nuxt
nuxt copied to clipboard
Server-side fetch / route only
I would like to create a route (/articles
) which only fetches data server-side. Is this possible with Nuxt 2?
I tried wrapping my asyncData
in a conditional if(process.server)
statement, but it only works if the route servers as a main entry point to the app (that is the user requests /articles
URL explicitly via their browser), but it breaks when you reach the route via other client-side page (ie. you go from /about
→ /articles
).
I also fiddled with Axios request cancellation, but it produces a network error.
Is there a nice way to achieve this?