continued migration
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import type { APIEvent } from "@solidjs/start/server";
|
||||
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
import { appRouter } from "~/server/api/root";
|
||||
import { createTRPCContext } from "~/server/api/utils";
|
||||
|
||||
const handler = (event: APIEvent) =>
|
||||
const handler = (event: APIEvent) => {
|
||||
// adapts tRPC to fetch API style requests
|
||||
fetchRequestHandler({
|
||||
return fetchRequestHandler({
|
||||
// the endpoint handling the requests
|
||||
endpoint: "/api/trpc",
|
||||
// the request object
|
||||
@@ -12,8 +13,9 @@ const handler = (event: APIEvent) =>
|
||||
// the router for handling the requests
|
||||
router: appRouter,
|
||||
// any arbitrary data that should be available to all actions
|
||||
createContext: () => event
|
||||
createContext: () => createTRPCContext(event),
|
||||
});
|
||||
};
|
||||
|
||||
export const GET = handler;
|
||||
export const POST = handler;
|
||||
|
||||
Reference in New Issue
Block a user