Skip to content

Instantly share code, notes, and snippets.

@woss
Last active August 28, 2019 12:38
Show Gist options
  • Save woss/15860b09c8575199a21057051a3fccc7 to your computer and use it in GitHub Desktop.
Save woss/15860b09c8575199a21057051a3fccc7 to your computer and use it in GitHub Desktop.
const isItIntrospectionQuery = (query: string): boolean => {
return query.includes('IntrospectionQuery')
}
const postgraphileOptions = {
async pgSettings(req: Request) {
if (isItIntrospectionQuery(JSON.stringify(req.body))) return {}
return {
role: 'DATABASE_VISITOR',
...['your', 'return']
}
},
async additionalGraphQLContextFromRequest(req) {
if (isItIntrospectionQuery(JSON.stringify(req.body))) return {}
return {
...['your', 'return']
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment