@falcondev-oss/nitro-trpc-event-handler

0.1.1 • Public • Published

tRPC Nitro Event Handler

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

Installation

npm install @falcondev-oss/nitro-trpc-event-handler

Usage

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,
    }
  }
})

Readme

Keywords

Package Sidebar

Install

npm i @falcondev-oss/nitro-trpc-event-handler

Weekly Downloads

17

Version

0.1.1

License

Apache-2.0

Unpacked Size

18.2 kB

Total Files

8

Last publish

Collaborators

  • louishaftmann
  • drjume