diff --git a/packages/apollo-server-cloud-function/README.md b/packages/apollo-server-cloud-function/README.md index 07b651c3..e28e3f0c 100644 --- a/packages/apollo-server-cloud-function/README.md +++ b/packages/apollo-server-cloud-function/README.md @@ -3,22 +3,22 @@ title: Google Cloud Functions description: Setting up Apollo Server with Google Cloud Functions --- -[![npm version](https://badge.fury.io/js/apollo-server-cloud-function.svg)](https://badge.fury.io/js/apollo-server-cloud-function) [![Build Status](https://circleci.com/gh/apollographql/apollo-server.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-server) [![Coverage Status](https://coveralls.io/repos/github/apollographql/apollo-server/badge.svg?branch=master)](https://coveralls.io/github/apollographql/apollo-server?branch=master) [![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](https://www.apollographql.com/#slack) +[![npm version](https://badge.fury.io/js/apollo-server-cloud-functions.svg)](https://badge.fury.io/js/apollo-server-cloud-functions) [![Build Status](https://circleci.com/gh/apollographql/apollo-server.svg?style=svg)](https://circleci.com/gh/apollographql/apollo-server) [![Coverage Status](https://coveralls.io/repos/github/apollographql/apollo-server/badge.svg?branch=master)](https://coveralls.io/github/apollographql/apollo-server?branch=master) [![Get on Slack](https://img.shields.io/badge/slack-join-orange.svg)](https://www.apollographql.com/#slack) This is the Google Cloud Function integration of GraphQL Server. Apollo Server is a community-maintained open-source GraphQL server that works with many Node.js HTTP server frameworks. [Read the docs](https://www.apollographql.com/docs/apollo-server/v2). [Read the CHANGELOG](https://github.com/apollographql/apollo-server/blob/master/CHANGELOG.md). ```sh -npm install apollo-server-cloud-function@rc graphql +npm install apollo-server-cloud-functions graphql ``` ## Deploying with Google Cloud Function #### 1. Write the API handlers -First, create a `package.json` file and include `apollo-server-cloud-function` in your dependencies. Then in a file named `index.js`, place the following code: +First, create a `package.json` file and include `apollo-server-cloud-functions` in your dependencies. Then in a file named `index.js`, place the following code: ```js -const { ApolloServer, gql } = require('apollo-server-cloud-function'); +const { ApolloServer, gql } = require('apollo-server-cloud-functions'); // Construct a schema, using GraphQL schema language const typeDefs = gql` @@ -60,7 +60,7 @@ You can refer to the [Cloud Functions documentation](https://cloud.google.com/fu To read information about the currently executing Google Cloud Function (HTTP headers, HTTP method, body, path, ...) use the context option. This way you can pass any request specific data to your schema resolvers. ```js -const { ApolloServer, gql } = require('apollo-server-cloud-function'); +const { ApolloServer, gql } = require('apollo-server-cloud-functions'); // Construct a schema, using GraphQL schema language const typeDefs = gql` @@ -94,7 +94,7 @@ exports.handler = server.createHandler(); To enable CORS the response HTTP headers need to be modified. To accomplish this use the `cors` option. ```js -const { ApolloServer, gql } = require('apollo-server-cloud-function'); +const { ApolloServer, gql } = require('apollo-server-cloud-functions'); // Construct a schema, using GraphQL schema language const typeDefs = gql` @@ -126,7 +126,7 @@ exports.handler = server.createHandler({ To enable CORS response for requests with credentials (cookies, http authentication) the allow origin header must equal the request origin and the allow credential header must be set to true. ```js -const { ApolloServer, gql } = require('apollo-server-cloud-function'); +const { ApolloServer, gql } = require('apollo-server-cloud-functions'); // Construct a schema, using GraphQL schema language const typeDefs = gql`