Open kingrupam opened 3 years ago
@kingrupam something like the following should do it:
const depthLimit = require('graphql-depth-limit')
const express = require('express')
const graphqlHTTP = require('express-graphql')
const app = express()
const schema = `...`
app.use('/graphql', graphqlHTTP((req, res) => ({
schema,
validationRules: [ depthLimit(7) ]
})))
app.listen(4000)
how to Limit query depth using express-graphql