If you have a client component which fetches to a routehandler, and that routehandler then fetches to an offsite API, is this what happens:
- The client (as in, javascript code downloaded by the visitor) makes a request to the nextjs backend (routehandler)
- The nextjs backend requests to the offsite API
- The offsite api responds
- The nextjs backend responds
So the example here: https://nextjs.org/docs/app/building-your-application/routing/route-handlers#caching is actually like an API, which wraps another API (at mongodb)? Shouldn't this kind of thing be discouraged as it's more traffic?
Obviously you could write the whole stack in NextJS - as it's a full stack framework - and this wouldn't need to use an offsite API.
And alternatively, you could use a library (e.g. react-query). Or even turn off caching and handle it yourself (reinvent the wheel 😬 ).