diff --git a/src/graphql/index.ts b/src/graphql/index.ts index 57d59f5..dd52720 100644 --- a/src/graphql/index.ts +++ b/src/graphql/index.ts @@ -6,36 +6,36 @@ import { resolvers } from "./resolvers"; import { typeDefs } from "./schema"; const schema = createSchema({ - typeDefs, - resolvers, + typeDefs, + resolvers, }); const yoga = createYoga({ - schema, - graphqlEndpoint: "/graphql", - landingPage: false, // Disable landing page for production - graphiql: { - title: "Aniplay GraphQL API", - }, - context: ({ request }) => { - // Extract Hono context from the request - // graphql-yoga passes the raw request, but we need Hono context - // This will be provided when we integrate with Hono - return request as any; - }, + schema, + graphqlEndpoint: "/graphql", + landingPage: false, // Disable landing page for production + graphiql: { + title: "Aniplay GraphQL API", + }, + context: ({ request }) => { + // Extract Hono context from the request + // graphql-yoga passes the raw request, but we need Hono context + // This will be provided when we integrate with Hono + return request as any; + }, }); const app = new Hono(); app.all("/", async (c) => { - const graphqlContext = createGraphQLContext(c); + const graphqlContext = await createGraphQLContext(c); - // Create a custom request object that includes our GraphQL context - const request = c.req.raw.clone(); - (request as any).graphqlContext = graphqlContext; + // Create a custom request object that includes our GraphQL context + const request = c.req.raw.clone(); + (request as any).graphqlContext = graphqlContext; - const response = await yoga.fetch(request, graphqlContext); - return response; + const response = await yoga.fetch(request, graphqlContext); + return response; }); export default app;