Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { ApolloServer } from 'apollo-server-express'
import * as express from 'express'
import { IResolvers } from 'graphql-tools'
import * as LRU from 'lru-cache'
import typeDefs, { Context } from './types'
const router = express.Router()
const resolvers: IResolvers<{}, Context> = {
JSON: require('graphql-type-json'),
Date: require('graphql-iso-date').GraphQLDateTime,
Query: {},
Mutation: {}
module.exports = ({
dev = false
}: {
app: express.Express
cache: LRU.Cache<any, any>
dev?: boolean
}) => {
new ApolloServer({
context: { cache },
introspection: dev,
playground: dev,
tracing: dev,
cacheControl: true
}).applyMiddleware({ app })
return router
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.