Skip to content

Latest commit

History

History
42 lines (28 loc) 路 1.16 KB

File metadata and controls

42 lines (28 loc) 路 1.16 KB

Apollo GraphQL & Cloud Functions for Firebase

Cloud Functions can accept an Express.js server as it's params as they share a similar request/response object (as discussed here). Using the apollo-server-express package we can quickly and easily setup a GraphQL server on FaaS.

The accompanying Medium post.

Install & Run

# Install
yarn
# Locally serve
yarn serve
# Deploy
yarn deploy

Routes

GraphQL Playground: https://us-central1-<project-id>.cloudfunctions.net/api

GraphQL Endpoint: https://us-central1-<project-id>.cloudfunctions.net/api/graphql

Use

Go to the GraphQL Playground route and enter the GraphQL endpoint route into the GraphQL Server address bar to connect the playground to your endpoint. Now you can query away and develop your app!

Here's the test query:

{
  hello
}