How can I add CloudFlare D1 database to the Context in trpc-nuxt handler? #1046
Unanswered
juretopolak
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using trpc-nuxt module which has createNuxtApiHandler:
It looks like
createContext(event: H3Event)
(in the createNuxtApiHandler) can accept only one parameter of type H3Event.How can I add D1Database when I need to pass another parameter
createContext(event: H3Event, env: Env)
to be able to access binded D1 database?Demo project:
https://github.com/juretopolak/trpc-nuxt/blob/main/server/trpc/context.ts
Beta Was this translation helpful? Give feedback.
All reactions