My express server is standard and I'm using GraphQL with it
const server = express();
server.use('/graphql', bodyParser.json(), graphqlExpress({ schema }));
I am wondering how to access the request
object within a resolver. Specifically, I need to verify the JWT in certain queries.
Below is the schema that has been imported:
const typeDefs = `
type User {
id: String,
name: String,
role: Int
}
type Query {
user(id: String): User,
users: [User]
}
`;
const resolvers = {
Query: {
user: (_, args, context, info) => users.find(u => u.id === args.id),
users: (_, args, context, info) => users
}
}
module.exports = makeExecutableSchema({typeDefs, resolvers});