Last active
August 21, 2017 04:16
-
-
Save JeffML/0b6a4ed30170f1ea8bbf110ff617e333 to your computer and use it in GitHub Desktop.
MyLittleDomain
This file contains hidden or 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 myLittleTypes = [{ | |
id: 1, | |
description: 'This is good', | |
}, { | |
id: 2, | |
description: 'This is better', | |
}, { | |
id: 3, | |
description: 'This is the best!', | |
}]; | |
export { | |
myLittleTypes | |
}; |
This file contains hidden or 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
export default ` | |
type MyLittleType { | |
id: Int! | |
description: String | |
}` |
This file contains hidden or 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
import { | |
myLittleTypes | |
} from './dataSource'; | |
const rootResolvers = { | |
Query: { | |
myLittleType: (_, { | |
id | |
}) => myLittleTypes.find(t => t.id === id) | |
}, | |
}; | |
export default rootResolvers; |
This file contains hidden or 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
import MyLittleType from './components/myLittleType' | |
const typeDefs = | |
` | |
# the schema allows the following query: | |
extend type Query { | |
myLittleType(id: Int!): MyLittleType | |
} | |
`; | |
export default [typeDefs, MyLittleType]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment