Update to use yoga and pothos

This commit is contained in:
2025-03-24 16:23:12 -05:00
parent 4b25b58c18
commit 90b9e5cf1b
16 changed files with 1767 additions and 1120 deletions

View File

@@ -1,22 +1,15 @@
import 'server-only';
import { typeDefs, schema } from "@/graphql/schema";
import { ApolloServer } from "apollo-server-micro";
import { NextApiRequest, NextApiResponse } from "next";
import { schema } from '@/graphql/schema';
import { createYoga } from 'graphql-yoga';
const apolloServer = new ApolloServer({ typeDefs, schema });
const yoga = createYoga({
schema,
graphqlEndpoint: '/api/v1/graphql'
});
export default yoga;
export const config = {
api: {
bodyParser: false,
},
};
const startServer = apolloServer.start();
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
await startServer;
await apolloServer.createHandler({ path: '/api/v1/graphql' })(req, res);
}
bodyParser: false
}
}

View File

@@ -1,4 +1,3 @@
import 'server-only';
import { NextApiHandler } from "next";
import * as fs from 'fs';
import * as path from 'path';

View File

@@ -1,4 +1,3 @@
import 'server-only';
import { NextApiHandler } from "next";
import * as fs from 'fs';
import * as path from 'path';

View File

@@ -50,7 +50,7 @@ export const Page:React.FC<PageProps> = props => {
return (
<div>
<h1>{ game.name }</h1>
<h1>{ game.title }</h1>
<Link href={`/games/${game.id}/play`}>
Play Game