Update to use yoga and pothos
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'server-only';
|
||||
import { NextApiHandler } from "next";
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'server-only';
|
||||
import { NextApiHandler } from "next";
|
||||
import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user