trpc-solid

Stars
4

trpc-solid

Minimal example of using tRPC with Solid Start using the fetch adapter & Solid Query

Using the fetch adapter

import { type APIEvent } from "solid-start";
import {
  fetchRequestHandler,
  type FetchCreateContextFnOptions,
} from "@trpc/server/adapters/fetch";

const handler = (event: APIEvent) =>
  fetchRequestHandler({
    endpoint: "/api/trpc",
    req: event.request,
    router: appRouter,
    createContext,
  });
export { handler as GET, handler as POST };