import { fetchRequestHandler } from "@trpc/server/adapters/fetch"

import { appRouter } from "@/server"
import { createContext } from "@/server/context"

async function handler(req: Request) {
  return fetchRequestHandler({
    createContext,
    endpoint: "/api/web/trpc",
    req,
    router: appRouter,
  })
}

export { handler as GET, handler as POST }
