Created
February 10, 2020 09:39
-
-
Save dimuthu/9ba37d61c22c9068b9126337d1786338 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
const express = require('express'); | |
const graphqlHTTP = require('express-graphql'); | |
const mongo = require('mongoose'); | |
const app = express(); | |
const schema = require('./schema/schema'); | |
mongo.connect('mongodb://mongo:27017/example', { | |
useNewUrlParser: true, | |
useUnifiedTopology: true | |
}) | |
mongo.connection.once('open', () => { | |
console.log('connected to database'); | |
}) | |
app.use('/graphql', graphqlHTTP({ | |
graphiql: true, | |
schema: schema | |
})); | |
app.listen(8080, () => { | |
console.log('Server running succefully...') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment