Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {
decodeToken,
} from '~/src/app/auth/jwt'
const logger = pino({
enabled: !(process.env.LOG_ENABLED === 'false')
})
const environment = process.env.NODE_ENV || 'development'
const graphqlSchemaPath = (['development', 'test'].includes(environment)) ?
'./src/app/graphql' : './dist/app/graphql'
const {
schema,
resolver
} = glue(graphqlSchemaPath)
let graphQLSchema = makeExecutableSchema({
typeDefs: schema,
resolvers: resolver,
})
graphQLSchema = applyMiddleware(graphQLSchema, permissions)
const server = new ApolloServer({
schema: graphQLSchema,
introspection: true,
playground: true,
context: async ({ req }) => {
logger.info(req.headers, '[HEADERS]')
logger.info(req.body.query, '[QUERY]')
logger.info(req.body.variables, '[VARIABLES]')
import glue from 'schemaglue';
export const { schema, resolver } = glue('server/apollo');