From 860877b5243470fb6eb4e165665571fcfd823baf Mon Sep 17 00:00:00 2001 From: Simon Emanuel Schmid Date: Wed, 24 Apr 2024 07:39:02 +0100 Subject: [PATCH] Fix GraphQL Yoga docs example (#2485) --- website/src/pages/docs/get-started.mdx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/website/src/pages/docs/get-started.mdx b/website/src/pages/docs/get-started.mdx index fe2e0ee482..5a76136a01 100644 --- a/website/src/pages/docs/get-started.mdx +++ b/website/src/pages/docs/get-started.mdx @@ -97,15 +97,18 @@ Your GraphQL `Application` exposes `createExecution` and `createSubscription` me If you are using [GraphQL Yoga](https://the-guild.dev/graphql/yoga-server), you can use [`useGraphQLModules`](https://envelop.dev/plugins/use-graphql-modules) plugin from Envelop. ```ts -import { createServer } from '@graphql-yoga/node' +import { createServer } from "node:http" +import { createYoga } from "graphql-yoga" import { useGraphQLModules } from '@envelop/graphql-modules' import { application } from './application' -const server = createServer({ - plugins: [useGraphQLModules(application)] +const yoga = createYoga({ + plugins: [useGraphQLModules(application)], }) -server.start().then(() => { +const server = createServer(yoga) + +server.listen(4000, () => { console.log(`🚀 Server ready`) }) ```