Skip to content

Commit aee335d

Browse files
author
Johnwook Choi
committed
1 parent 32927ba commit aee335d

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

schema.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { makeExecutableSchema } from "graphql-tools";
2+
3+
// Some fake data
4+
const books = [
5+
{
6+
author: "J.K. Rowling",
7+
title: "Harry Potter and the Sorcerer's stone"
8+
},
9+
{
10+
author: "Michael Crichton",
11+
title: "Jurassic Park"
12+
}
13+
];
14+
15+
// The GraphQL schema in string form
16+
const typeDefs = `
17+
type Query { books: [Book] }
18+
type Book { title: String, author: String }
19+
`;
20+
21+
// The resolvers
22+
const resolvers = {
23+
Query: { books: () => books }
24+
};
25+
26+
// Put together a schema
27+
const schema = makeExecutableSchema({
28+
resolvers,
29+
typeDefs
30+
});
31+
32+
export default schema;

0 commit comments

Comments
 (0)