Last active
November 27, 2018 22:05
-
-
Save mizchi/cc1ffd86d79787dc4cda30fe016c3513 to your computer and use it in GitHub Desktop.
GraphQL on Firebase
This file contains 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
/* @flow */ | |
import * as functions from 'firebase-functions' | |
import express from 'express' | |
import Cors from 'cors' | |
import { graphqlExpress } from 'apollo-server-express' | |
import bodyParser from 'body-parser' | |
import { makeExecutableSchema } from 'graphql-tools' | |
const schema = makeExecutableSchema({typeDefs: [/* Your schema.graphql */], resolvers: {/* Your resolver */} }) | |
const cors = Cors({ origin: true }) | |
const server = express().use( | |
cors, | |
bodyParser.json(), | |
graphqlExpress({ schema, context: {} }) | |
) | |
export const graphql = functions.https.onRequest(server) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment