We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32927ba commit aee335dCopy full SHA for aee335d
schema.ts
@@ -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