How to access the event in a server/utils function?
I've created a server utility function in /server/utils/get-facebook-account.ts which looks like this
I'm using Supabase so for the serverSupabaseClient I need the event.
Now I'm wondering, do I always need to pass the event to my utility function like this?
/server/api/campaign.post.ts
Because I've read there is a useRequestEvent
composable but it's only available in the Nuxt context. Is there something similar for /server functions?
Thanks!2 Replies
I haven’t tried this but saw it mentioned on another thread. https://nitro.unjs.io/guide/utils#async-context-experimental
Nitro
Server Utils · Nitro
Create web servers with everything you need and deploy them wherever you prefer.
@kingtimm this worked perfectly, thank you!