I`m trying to work with GraphQL/Apollo, and my "Documentation Explorer" loading infinitely and doesnt show anything, and i can't make any queries.
After few minutes I getting an typeError "Failed to fetch"
.
Here's my graphql/index.js
file:
const { graphqlExpress, graphiqlExpress } = require('apollo-server-express');
const { makeExecutableSchema } = require('graphql-tools');
const User = require('../models/user.model');
const typeDefs = `
type Query {
users: [User]
}
type User {
id: ID!
name: String
email: String
password: String
}
`;
const resolvers = {
Query: {
users() {
return User.find({});
}
}
}
const schema = makeExecutableSchema({
typeDefs,
resolvers,
});
module.exports = (app) => {
app.use('/graphql', () => { }, graphqlExpress({ schema }));
app.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql' }));
};
Console and DevTools both clear. Can someone explain, what`s wrong? Thank you !