Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { makeExecutableSchema } = require('graphql-tools')
- const { Binding } = require('graphql-binding')
- const users = [
- {
- name: 'Alice',
- },
- {
- name: 'Bob',
- },
- ]
- const typeDefs = `
- type Query {
- findUser(name: String!): User
- }
- type User {
- name: String!
- }
- `
- const resolvers = {
- Query: {
- findUser: (parent, { name }) => users.find(u => u.name === name),
- },
- }
- const schema = makeExecutableSchema({ typeDefs, resolvers })
Add Comment
Please, Sign In to add comment