File tree 3 files changed +24
-18
lines changed
3 files changed +24
-18
lines changed Original file line number Diff line number Diff line change
1
+ const fakeBooks = [
2
+ {
3
+ author : "J.K. Rowling" ,
4
+ title : "Harry Potter and the Sorcerer's stone"
5
+ } ,
6
+ {
7
+ author : "Michael Crichton" ,
8
+ title : "Jurassic Park"
9
+ }
10
+ ] ;
11
+
12
+ const books = ( ) => fakeBooks ;
13
+
14
+ export { books } ;
Original file line number Diff line number Diff line change
1
+ import { books } from "./books" ;
2
+
3
+ const resolvers = {
4
+ Query : {
5
+ books
6
+ }
7
+ } ;
8
+
9
+ export default resolvers ;
Original file line number Diff line number Diff line change 1
1
import { importSchema } from "graphql-import" ;
2
2
import { makeExecutableSchema } from "graphql-tools" ;
3
3
4
- // Some fake data
5
- const books = [
6
- {
7
- author : "J.K. Rowling" ,
8
- title : "Harry Potter and the Sorcerer's stone"
9
- } ,
10
- {
11
- author : "Michael Crichton" ,
12
- title : "Jurassic Park"
13
- }
14
- ] ;
15
-
4
+ import resolvers from "./resolvers" ;
16
5
const typeDefs = importSchema ( "typeDefs/schema.graphql" ) ;
17
6
18
- // The resolvers
19
- const resolvers = {
20
- Query : { books : ( ) => books }
21
- } ;
22
-
23
- // Put together a schema
24
7
const schema = makeExecutableSchema ( {
25
8
resolvers,
26
9
typeDefs
You can’t perform that action at this time.
0 commit comments