This commit is contained in:
2025-10-31 16:06:03 -04:00
commit ff334a7f0d
42 changed files with 15172 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
import resolvers from "@/graphql/resolvers";
import typeDefs from "@/graphql/types";
import { createSchema, createYoga } from "graphql-yoga";
interface NextContext {
params: Promise<Record<string, string>>;
}
const { handleRequest } = createYoga<NextContext>({
schema: createSchema({
typeDefs: typeDefs,
resolvers: resolvers
}),
// While using Next.js file convention for routing, we need to configure Yoga to use the correct endpoint
graphqlEndpoint: "/api/graphql",
// Yoga needs to know how to create a valid Next response
fetchAPI: { Response }
});
export {
handleRequest as GET,
handleRequest as POST,
handleRequest as OPTIONS
};