Created
April 11, 2018 10:45
-
-
Save wojciech-bilicki/e7665611390dff8e349d94a73eead719 to your computer and use it in GitHub Desktop.
server with schema
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 {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