Skip to content

Instantly share code, notes, and snippets.

@JeffML
Last active August 21, 2017 04:16
Show Gist options
  • Save JeffML/0b6a4ed30170f1ea8bbf110ff617e333 to your computer and use it in GitHub Desktop.
Save JeffML/0b6a4ed30170f1ea8bbf110ff617e333 to your computer and use it in GitHub Desktop.
MyLittleDomain
const myLittleTypes = [{
id: 1,
description: 'This is good',
}, {
id: 2,
description: 'This is better',
}, {
id: 3,
description: 'This is the best!',
}];
export {
myLittleTypes
};
export default `
type MyLittleType {
id: Int!
description: String
}`
import {
myLittleTypes
} from './dataSource';
const rootResolvers = {
Query: {
myLittleType: (_, {
id
}) => myLittleTypes.find(t => t.id === id)
},
};
export default rootResolvers;
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