-
-
Save AgustinCastella/f5d9e446a0ad30670df09bb82da08167 to your computer and use it in GitHub Desktop.
Define your graphql schema
This file contains 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 express = require('express'); | |
const { ApolloServer, gql } = require('apollo-server-express'); | |
// A schema is a collection of type definitions (hence "typeDefs") | |
// that together define the "shape" of queries that are executed against | |
// your data. | |
const typeDefs = gql` | |
# Comments in GraphQL strings (such as this one) start with the hash (#) symbol. | |
# This "Book" type defines the queryable fields for every book in our data source. | |
type Book { | |
title: String | |
author: String | |
} | |
# The "Query" type is special: it lists all of the available queries that | |
# clients can execute, along with the return type for each. In this | |
# case, the "books" query returns an array of zero or more Books (defined above). | |
type Query { | |
books: [Book] | |
} | |
`; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment