-
-
Save SaraVieira/f294a151bc73965961cbb2fd19a7c06e to your computer and use it in GitHub Desktop.
This file contains 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 resolvers = { | |
Query: { | |
movies: () => movies, | |
movie: (_, { id }) => movies.find(movie => movie.id == id) | |
}, | |
Mutation: { | |
addMovie: (_, { title, year }) => { | |
const newMovie = { | |
title, | |
year, | |
id: randomId(10) | |
} | |
movies.push(newMovie) | |
return newMovie | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment