add graph ql applol express code example
Example 1: setup apollo server express
npm install apollo-server-express
yarn add apollo-server-express
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress } from 'apollo-server-express';
const myGraphQLSchema = // ... define or import your schema here!
const PORT = 3000;
const app = express();
// bodyParser is needed just for POST.
app.use('/graphql', bodyParser.json(), graphqlExpress({ schema: myGraphQLSchema }));
app.listen(PORT);
Example 2: install apollo server
npm install apollo-server graphql
yarn add apollo-server graphql