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