tRPC event handler for Nitro with support for Nitro's helper functions (e.g. sendStream
or sendRedirect
).
Also works with any Nitro based framework like Nuxt or SolidStart.
Warning
Only works with tRPC v11
npm install @falcondev-oss/nitro-trpc-event-handler
api/trpc/[trpc].ts
(← make sure to name the path segment trpc
)
import { defineTRPCEventHandler } from '@falcondev-oss/nitro-trpc-event-handler'
import { appRouter } from './trpc/router'
export default defineTRPCEventHandler({
router: appRouter,
createContext: (event) => {
// add your own tRPC context here
return {
event,
}
}
})