API Handler

Creating a tRPC API handler

Usage

Go to routes/api/trpc/[trpc].ts and add the following:

import { createSolidAPIHandler } from '@solid-mediakit/trpc/handler'
import { createContext } from '~/server/trpc/context'
import { appRouter } from '~/server/trpc/router/_app'

const handler = createSolidAPIHandler({
  router: appRouter,
  createContext,
})

export const { GET, POST } = handler

You now have a working tRPC API handler at /api/trpc/[trpc].