Showing
1 changed file
with
10 additions
and
1 deletions
... | @@ -3,10 +3,19 @@ dotenv.config(); | ... | @@ -3,10 +3,19 @@ dotenv.config(); |
3 | import { GraphQLServer } from "graphql-yoga"; | 3 | import { GraphQLServer } from "graphql-yoga"; |
4 | import morgan from "morgan"; | 4 | import morgan from "morgan"; |
5 | import schema from "./schema"; | 5 | import schema from "./schema"; |
6 | +import { prisma } from "./utils"; | ||
6 | 7 | ||
7 | const PORT = process.env.PORT; | 8 | const PORT = process.env.PORT; |
8 | 9 | ||
9 | -const server = new GraphQLServer({ schema }); | 10 | +const server = new GraphQLServer({ |
11 | + schema, | ||
12 | + context: (request) => { | ||
13 | + return { | ||
14 | + ...request, | ||
15 | + prisma, | ||
16 | + }; | ||
17 | + }, | ||
18 | +}); | ||
10 | 19 | ||
11 | server.express.use(morgan("dev")); | 20 | server.express.use(morgan("dev")); |
12 | 21 | ... | ... |
-
Please register or login to post a comment