Skip to content

Commit 860877b

Browse files
authored
Fix GraphQL Yoga docs example (#2485)
1 parent 4505a05 commit 860877b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

website/src/pages/docs/get-started.mdx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,18 @@ Your GraphQL `Application` exposes `createExecution` and `createSubscription` me
9797
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.
9898

9999
```ts
100-
import { createServer } from '@graphql-yoga/node'
100+
import { createServer } from "node:http"
101+
import { createYoga } from "graphql-yoga"
101102
import { useGraphQLModules } from '@envelop/graphql-modules'
102103
import { application } from './application'
103104

104-
const server = createServer({
105-
plugins: [useGraphQLModules(application)]
105+
const yoga = createYoga({
106+
plugins: [useGraphQLModules(application)],
106107
})
107108

108-
server.start().then(() => {
109+
const server = createServer(yoga)
110+
111+
server.listen(4000, () => {
109112
console.log(`🚀 Server ready`)
110113
})
111114
```

0 commit comments

Comments
 (0)