Created
May 2, 2018 21:11
-
-
Save peggyrayzis/cf7beaf050f9b3cfa6a20bbf4195bca5 to your computer and use it in GitHub Desktop.
Apollo Server 2.0
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'); | |
// 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: () => "world" | |
} | |
}; | |
const server = new ApolloServer({ typeDefs, resolvers }); | |
server.listen().then(({ url }) => { | |
console.log(`🚀 Server ready at ${url}`) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment