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

Commit

Permalink
Fix example of apollo-server-express usage
Browse files Browse the repository at this point in the history
Update valid usage of apollo-server-express package from package's latest docs:
https://github.com/apollographql/apollo-server/blob/master/packages/apollo-server-express/README.md
  • Loading branch information
RusinovAnton authored Oct 4, 2019
1 parent 78c24e9 commit 250376e
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 250376e

Please sign in to comment.