const axios = require(\'axios\');
const mongodb = require(\'mongodb\');
const MongoClient = mongodb.MongoClient;
const url = \"mongodb://localhost:27017/graphql\";
here how you connect express-graphql
const express = require('express');
const expressGraphQL = require('express-graphql');
const schema = require('./schema');
const app = express();
app.use(
'/graphql',
expressGraphQL({
schema,
graphiql: true
})
);
you return the connection in the resolve correct it to
resolve(parent, args) {
MongoClient.connect(url, (err, client) => {
return client.db('graphql').collection('users').find()
});
}