When to use Fetch in RequestEvent #13477
Replies: 1 comment
-
See the note in the fetch APIs documentation:
So it's available pretty much everywhere and when the code runs on the server, it does not even involve a network call. There is also some more documentation in the types section of the docs, see e.g. the |
Beta Was this translation helpful? Give feedback.
-
I have go through many tutorials and it's not clear of when to use the
fetch
in the theRequestEvent
object.For example, in the +page.server.js:
My question is in which file I can use the fetch from the
RequestEvent
:And when should I use it? One of the reason I could think of is when calling the local API such as
/test
instead of the absolute URl from outside the website. Am I correct? Any other circumstances?Beta Was this translation helpful? Give feedback.
All reactions