Skip to content

Instantly share code, notes, and snippets.

View jakangah's full-sized avatar
🎯
Focusing

Justice Adeenze-Kangah jakangah

🎯
Focusing
  • KeySpecs
View GitHub Profile
@jakangah
jakangah / server.js
Created February 7, 2019 16:40
Implementing custom authorization when using express-graphql
# We accomplish this by passing the req and res objects from the expressjs router to the context option
# After getting the specific role or permission from the query instance we can accomplish route validation
let graphQLSchema = {
......
resolve: async function(root, args, context){
context.role = 'ADMIN'
}
}