Skip to content

Instantly share code, notes, and snippets.

@thekarel
Created January 23, 2020 23:32
Show Gist options
  • Save thekarel/77756cda5b070b7bbb7d7bcf4f175427 to your computer and use it in GitHub Desktop.
Save thekarel/77756cda5b070b7bbb7d7bcf4f175427 to your computer and use it in GitHub Desktop.
Apollo Server on Firebase Functions
import * as functions from 'firebase-functions'
import {ApolloServer, gql} from 'apollo-server-cloud-functions'
const typeDefs = gql`
type Query {
hello: String
}
`
const resolvers = {
Query: {
hello: () => 'Hello world!',
},
}
const server = new ApolloServer({
typeDefs,
resolvers,
playground: true,
introspection: true,
})
export const graphql = functions.https.onRequest(server.createHandler())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment