The combination of API routes and data loading functions
I have been trying out integrating my existing API routes with
The goal is to have the benefit of 1) preloading route data 2) having an open API 3) and being able to easily log API accesses.
The examples with SS seem to want you to utilize server functions which would not be an open API and (I dunno) how I would log properly
If I call
I need cookies/credentials, so calling on client is good because the browser will pass them, but on server there is no credentials and CF errors
I can utilize
But this seems very non-ergonomic.. It seems as though deciding to use
cache and action deploying to cloudflare.The goal is to have the benefit of 1) preloading route data 2) having an open API 3) and being able to easily log API accesses.
The examples with SS seem to want you to utilize server functions which would not be an open API and (I dunno) how I would log properly
If I call
fetch to an API route inside cache with no use server then it can be called on either client or serverI need cookies/credentials, so calling on client is good because the browser will pass them, but on server there is no credentials and CF errors
I can utilize
use server to make each call a server function that calls an API route, then extract the headers from the event and wire into the fetch to make it as close as possible as if I called the API route from the browserBut this seems very non-ergonomic.. It seems as though deciding to use
cache and action means not having a good time with API routes, and instead opting to using only server functions