Created
January 23, 2020 23:32
-
-
Save thekarel/77756cda5b070b7bbb7d7bcf4f175427 to your computer and use it in GitHub Desktop.
Apollo Server on Firebase Functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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