Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 11 additions & 21 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -34,7 +34,7 @@ app.use(helmet());
app.disable('x-powered-by');

/**
* API Routers
* API Routes
*/
app.use(clientApiRouter);
app.use(adminRouter);
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/client/permission-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const permissionType = new GraphQLObjectType({
type: GraphQLString
},
permissions: {
type: GraphQLList(elementPermissionsType)
type: new GraphQLList(elementPermissionsType)
}
}
});