Skip to content

Instantly share code, notes, and snippets.

@shamique
Created January 9, 2021 15:53
Show Gist options
  • Save shamique/0bf9cc108d87326deb1c9ec72d3f5d74 to your computer and use it in GitHub Desktop.
Save shamique/0bf9cc108d87326deb1c9ec72d3f5d74 to your computer and use it in GitHub Desktop.
GraphQL_Serverless_API
// Import Apollo Azure integration library
const { ApolloServer, gql } = require('apollo-server-azure-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 });
exports.graphqlHandler = server.createHandler();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment