Skip to content

Instantly share code, notes, and snippets.

@SaraVieira
Created October 24, 2018 12:59
Show Gist options
  • Save SaraVieira/34330f4d4fcd20bfff79303aa2c0b30c to your computer and use it in GitHub Desktop.
Save SaraVieira/34330f4d4fcd20bfff79303aa2c0b30c to your computer and use it in GitHub Desktop.
const { ApolloServer, gql } = require("apollo-server");
// Construct a schema, using GraphQL schema language
const typeDefs = gql`
type Query {
image: String,
notImage: String
}
`;
// Provide resolver functions for your schema fields
const resolvers = {
Query: {
image: () =>
"https://uploads.codesandbox.io/uploads/user/8d35d7c1-eecb-4aad-87b0-c22d30d12081/l2nh-cat.jpeg",
notImage: () => "https://unsplash.com/search/photos/cat"
}
};
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