I was able to set up Apollo GraphQL Server with Express.
However, the Playground is not working. The page loads but all queries I try to make from the Playground fail with HTTP 401 Unauthorized
.
My code:
const server = new ApolloServer({
schema: MySchema,
context: ({ req }) => ({
connection: req.context.db,
auth: req.context.auth,
}),
playground: true,
});
// Add to Express
app.use(server.getMiddleware({ path: '/graphql' }));
The Playground is running at localhost:4000/graphql, however all queries I make fail with HTTP 401 Unauthorized
.