Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Commit

Permalink
Merge pull request #666 from RusinovAnton/patch-1
Browse files Browse the repository at this point in the history
Fix example of apollo-server-express usage
  • Loading branch information
hwillson authored Aug 12, 2020
2 parents 8342e43 + 250376e commit 191925d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/source/express.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For example: if your server is already running on port 3000 and accepts GraphQL
```js
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress } from 'apollo-server-express';
import { ApolloServer, gql } from 'apollo-server-express';
import { createServer } from 'http';
import { execute, subscribe } from 'graphql';
import { PubSub } from 'graphql-subscriptions';
Expand All @@ -20,7 +20,10 @@ import { myGraphQLSchema } from './my-schema';
const PORT = 3000;
const app = express();

app.use('/graphql', bodyParser.json(), graphqlExpress({ schema: myGraphQLSchema }));
app.use('/graphql', bodyParser.json());

const apolloServer = new ApolloServer({ schema: myGraphQLSchema });
apolloServer.applyMiddleware({ app });

const pubsub = new PubSub();
const server = createServer(app);
Expand Down

0 comments on commit 191925d

Please sign in to comment.