You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This was kinda previously brought up in #4767 and the docs page is a good start, but the example provided is very basic and I feel that more context/details are needed.
📋 General description or bullet points (if proposing new content)
Suggestions:
Provide some context on how this call to the endpoint is made: Is it literally just calling the endpoint function, and does that mean APIContext is the same Astro global I pass i.e. url/etc. will be incorrect? Or is there some magic happening?
Mention that dynamic routes are either not supported, or provide a recommendation for how params should be passed
🖥️ Reproduction of code samples in StackBlitz
When it comes to passing params when calling an endpoint on the server, #4767 commenters offered two possibilities, and neither feel great.
in both cases, the details of the request passed to the api server endpoint are for the current page and not the api endpoint being called. at least, that's my assumption as i didn't confirm.
at any rate, some clarification on this recipe would be much appreciated.
The text was updated successfully, but these errors were encountered:
Yeah, this is definitely the better approach. I think we'll discuss retiring this article and recommending people just separate out their logic. Do let me know if you have any use-case where this pattern makes more sense though!
📚 Subject area/topic
Calling server endpoints on the server
📋 Suggested page
This page exists here, but is lacking: https://docs.astro.build/en/recipes/call-endpoints/
This was kinda previously brought up in #4767 and the docs page is a good start, but the example provided is very basic and I feel that more context/details are needed.
📋 General description or bullet points (if proposing new content)
Suggestions:
🖥️ Reproduction of code samples in StackBlitz
When it comes to passing params when calling an endpoint on the server, #4767 commenters offered two possibilities, and neither feel great.
spread:
use astro middleware util createContext, which appears undocumented from a quick search of astro docs:
in both cases, the details of the request passed to the api server endpoint are for the current page and not the api endpoint being called. at least, that's my assumption as i didn't confirm.
at any rate, some clarification on this recipe would be much appreciated.
The text was updated successfully, but these errors were encountered: