Repository URL to install this package:
|
Version:
2.0.12 ▾
|
import bodyParser from 'body-parser'
// export const typeDefs = require('./generated/skava-graphql.graphql').default
/**
* @@perf @todo need to import graphiql & create this only with a flag
*/
// import { apolloExpressMiddleware } from './deps/apolloExpress'
// graphiqlExpress({ endpointURL: '/graphql' })
// function subscribePlayground(app) {
// // GraphQL Playground, a visual editor for queries
// // app.use('/graphql', bodyParser.json(), graphqlExpress({ schema }))
// if (process.env.SHOULD_USE_GRAPHIQL) {
// console.log('[gql] adding graphiql')
// // app.use('/graphiql', graphiqlSubApp)
// }
// if (process.env.SHOULD_USE_PLAYGROUND) {
// console.log('[gql] adding playground')
// const graphqlPlayground = require('graphql-playground-middleware-express').default
// app.get(
// '/graphiql',
// graphqlPlayground({ endpoint: '/graphql', cors: false, bodyParserConfig: false })
// )
// }
// }
// @note - this middleware replaces the functionality of
// server.applyMiddleware({ app })
// function createApolloMiddleware() {
// console.debug('[uxui-graphql] subscribing apollo manual override')
// const server = createServer()
// const toServerContextOptions = server.createGraphQLServerOptions.bind(server)
// const middleware = (req, res, next) => {
// console.log('[uxui-graphql] apollo request')
// const apolloMiddleware = apolloExpressMiddleware(toServerContextOptions)
// apolloMiddleware(req, res, next)
// // if we add next here, it sets headers afterwards that throw errors
// // next()
// }
// return middleware
// }