Try out graphql running without a server
Please note that all query delays are synthetic and emulated to show async/await support in resolvers.View source on
Schema
type Query { authors: [Author]! author(name: String!): Author! books: [Book]! } type Author { name: String! age: Int! addedAt: String! books: [Book]! } type Book { name: String! publisher: String! publishedYear: Int! authors: [Author!] } input AuthorInput { name: String! age: Int! } input BookInput { name: String! publisher: String! publishedYear: Int! } type Mutation { addAuthor(author: AuthorInput!): Author! addBookForAuthor(authorName: String!, book: BookInput): Book! } type Subscription { numbers(from: Int, to: Int): Int! }
Example queries
You can click 'em to paste 'emsubscription { numbers }
mutation { newAuthor: addAuthor(author: { name: "Test Author", age: 99 }) { name age books { name publisher publishedYear authors { name age addedAt } } addedAt } }
mutation { addBookForAuthor( authorName: "Test Author" book: { name: "Some book lad", publisher: "Penguin", publishedYear: 1999 } ) { name publisher publishedYear authors { name age addedAt books { name publisher publishedYear } } } }
subscription numbers($from: Int, $to: Int) { numbers(from: $from, to: $to) }
{ req: gql` mutation addAuthor($author: AuthorInput!) { newAuthor: addAuthor(author: $author) { name age books { name publisher publishedYear authors { name age addedAt } } addedAt } } `, variables: { author: { name: 'Another Author', age: 21 } } }
{ req: gql` mutation addBook($authorName: String!, $book: BookInput!) { addBookForAuthor(authorName: $authorName, book: $book) { name publisher publishedYear authors { name age addedAt books { name publisher publishedYear } } } } `, variables: { author: 'Test Author', book: { name: 'Some book lad', publisher: 'Penguin', publishedYear: 1999 } } }
{ authors { name age books { name publisher publishedYear authors { name age addedAt } } addedAt } }
{ books { name publisher publishedYear authors { name age addedAt } } }
{ author(name: "Test Author") { name age books { name publisher publishedYear authors { name age addedAt } } addedAt } }