gcloud functions deploy function-1 --entry-point handler --runtime nodejs8 --trigger-http
Last active
October 13, 2019 19:31
-
-
Save RusticFlare/407ccc51387d2f987683727062fa90b8 to your computer and use it in GitHub Desktop.
GraphQL Cloud Function
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
DEPLOY.md | |
graphql-cloud-function-set-up.jpg |
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
const { ApolloServer, gql } = require('apollo-server-cloud-functions'); | |
// Construct a schema, using GraphQL schema language | |
const typeDefs = gql` | |
type Query { | |
hello: String | |
} | |
`; | |
// Provide resolver functions for your schema fields | |
const resolvers = { | |
Query: { | |
hello: () => 'Hello world!', | |
}, | |
}; | |
const server = new ApolloServer({ | |
typeDefs, | |
resolvers, | |
playground: true, | |
introspection: true, | |
}); | |
exports.handler = server.createHandler(); |
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
{ | |
"name": "function-1", | |
"version": "0.0.1", | |
"dependencies": { | |
"apollo-server-cloud-functions": "2.9.6" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment