diff --git a/package.json b/package.json index f4f1957..6e6e328 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,9 @@ "cors": "^2.8.5", "express": "^4.18.2", "express-basic-auth": "^1.2.1", - "express-graphql": "^0.12.0", "express-validator": "^7.0.1", - "graphql": "^15.8.0", + "graphql": "^16.6.0", + "graphql-http": "^1.18.0", "graphql-tag": "^2.12.6", "helmet": "^7.0.0", "jsonwebtoken": "^9.0.0", diff --git a/src/app.js b/src/app.js index 7f5e601..fe8a348 100644 --- a/src/app.js +++ b/src/app.js @@ -1,6 +1,6 @@ import express from 'express'; import swaggerUi from 'swagger-ui-express'; -import { graphqlHTTP } from 'express-graphql'; +import { createHandler } from 'graphql-http/lib/use/express'; import cors from 'cors'; import helmet from 'helmet'; @@ -34,7 +34,7 @@ app.use(helmet()); app.disable('x-powered-by'); /** - * API Routers + * API Routes */ app.use(clientApiRouter); app.use(adminRouter); @@ -50,28 +50,18 @@ app.use(permissionRouter); app.use(slackRouter); /** - * Component: Client API - GraphQL + * GraphQL Routes */ -app.use('/graphql', appAuth, graphqlHTTP({ - schema, - graphiql: true -})); -/** - * Admin: Client API - GraphQL - */ -app.use('/adm-graphql', auth, graphqlHTTP({ - schema, - graphiql: true -})); +const handler = (req, res, next) => + createHandler({ schema, context: req})(req, res, next); -/** - * Slack: Client API - GraphQL - */ - app.use('/slack-graphql', slackAuth, graphqlHTTP({ - schema, - graphiql: true -})); +// Component: Client API +app.use('/graphql', appAuth, handler); +// Admin: Client API +app.use('/adm-graphql', auth, handler); +// Slack: Client API +app.use('/slack-graphql', slackAuth, handler); /** * API Docs and Health Check diff --git a/src/client/permission-type.js b/src/client/permission-type.js index 37bc97c..75766bf 100644 --- a/src/client/permission-type.js +++ b/src/client/permission-type.js @@ -22,7 +22,7 @@ export const permissionType = new GraphQLObjectType({ type: GraphQLString }, permissions: { - type: GraphQLList(elementPermissionsType) + type: new GraphQLList(elementPermissionsType) } } }); \ No newline at end of file