Skip to content

Instantly share code, notes, and snippets.

@wojciech-bilicki
Created April 11, 2018 10:45
Show Gist options
  • Save wojciech-bilicki/e7665611390dff8e349d94a73eead719 to your computer and use it in GitHub Desktop.
Save wojciech-bilicki/e7665611390dff8e349d94a73eead719 to your computer and use it in GitHub Desktop.
server with schema
import express from 'express';
import {graphiqlExpress, graphqlExpress } from 'apollo-server-express';
import bodyParser from 'body-parser';
import schema from './schema';
const server = express();
server.use('/graphiql', graphiqlExpress({
endpointURL: "/graphql"
}))
server.use('/graphql',bodyParser.json(), graphqlExpress({
schema
}))
server.listen(4000, () => {
console.log('Server ready on port 4000')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment