Closed apaciuk closed 4 years ago
Could you create a reproduction?
Hi yes all code is here, in the server express index file:
const express = require('express'); const { ApolloServer } = require('apollo-server-express'); const importSchema = require('graphql-import'); const makeExecutableSchema = require ('graphql-tools'); const graphqlHTTP = require('express-graphql');
const typeDefs = importSchema('./schema.graphql'); const resolvers = {}; const middleware = new graphqlHTTP();
const schema = makeExecutableSchema({ typeDefs, resolvers });
const server = new ApolloServer({ schema });
const app = express(); server.applyMiddleware({ app, middleware });
app.listen({ port: 4000 }, () =>
console.log(🚀 Server ready at http://localhost:4000${server.graphqlPath}
)
);
seems just the importSchema is not working, not a function
Thanks
It's supposed to be const { importSchema } = require('graphql-import');
not const importSchema = require('graphql-import')
It is a function inside the module.
I am getting error with this, says importSchema is not a function?
const typeDefs = importSchema('./schema.graphql'); ^
TypeError: importSchema is not a function
Any tips on this at all?
Thanks