Skip to content

Instantly share code, notes, and snippets.

@unicodeveloper
Created August 18, 2017 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unicodeveloper/22609209d3ffa0f8a70d795bb29bfacb to your computer and use it in GitHub Desktop.
Save unicodeveloper/22609209d3ffa0f8a70d795bb29bfacb to your computer and use it in GitHub Desktop.
import express from ‘express’;
import { graphqlExpress, graphiqlExpress } from ‘apollo-server-express’;
import logger from ‘./config/logdna’;
import bodyParser from ‘body-parser’;
import schema from ‘./data/schema’;
const GRAPHQL_PORT = 3000;
// Create Express instance
const app = express();
// Define the endpoint for GraphQL and GraphIQL
app.use(‘/api’, bodyParser.json(), graphqlExpress({ schema }));
app.use(‘/api-ui’, graphiqlExpress({ endpointURL: ‘/api’ }));
// Run the Express instance on desired port
app.listen(GRAPHQL_PORT, () => logger.log(‘The app backend is now running’));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment