Open chopraapooja opened 4 years ago
const express = require('express')
const graphqlHTTP = require('express-graphql')
const bodyParser = require('body-parser')
const { createSchema } = require('./OTG');
const cors = require('cors');
const { compileQuery } = require("graphql-jit");
const { parse } = require('graphql');
// TODO: use better cache with invalidation
const cache = {};
async function startServer() {
const schema = await createSchema();
const app = express()
app.use(bodyParser.json())
app.use(cors());
app.use('/', graphqlHTTP((_, __, { query }) => {
if (!(query in cache)) {
const document = parse(query);
cache[query] = compileQuery(schema, document);
}
return {
graphiql: true,
schema,
customExecuteFn: ({ rootValue, variableValues, contextValue }) => {
return cache[query].query(rootValue, contextValue, variableValues);
}
}
}))
app.listen(8080, () => {
console.log(`Access graphql at http://localhost:8080`);
})
}
// Kick things off:
startServer()```
After adding grapqhql-jit to running express-graphql it started giving above error. I am using Peer Dependency graphql version 14.6.0