Created
August 18, 2017 02:41
-
-
Save unicodeveloper/22609209d3ffa0f8a70d795bb29bfacb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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