@@ -30,13 +30,13 @@ We are going to create our own GraphQL API on top of this [Rick and Morty API](h
...
@@ -30,13 +30,13 @@ We are going to create our own GraphQL API on top of this [Rick and Morty API](h
### Tasks
### Tasks
-[] 1. Create a `Character` type in your schema. Use the [documentation of the character endpont](https://rickandmortyapi.com/documentation/#character-schema) to define the shape of the `Character` type.
-[] 1. Create a `Character` type in your schema. Use the [documentation of the character endpoint](https://rickandmortyapi.com/documentation/#character-schema) to define the shape of the `Character` type.
-[] 1.1. Add a `characters` field to the Query type. You can replace the `books` field from Query type on line 32 with `characters` since we won't use books. The `characters` field should return an array of [Character].
-[] 1.1. Add a `characters` field to the Query type. You can replace the `books` field from Query type on line 32 with `characters` since we won't use books. The `characters` field should return an array of [Character].
-[] 1.2. Add a `characters` resolver to the Query's resolvers. You can replace the `books` field from Query type on line 40 with `characters` since we won't use books. You can return the mock characters array which is in the scope and defined at the bottom of the file index.js.
-[] 1.2. Add a `characters` resolver to the Query's resolvers. You can replace the `books` field from Query type on line 40 with `characters` since we won't use books. You can return the mock characters array which is in the scope and defined at the bottom of the file index.js.
-[] 1.3 You should be able to manually test the `characters` query in Playground at [http://localhost:4000/](http://localhost:4000/)
-[] 1.3 You should be able to manually test the `characters` query in Playground at [http://localhost:4000/](http://localhost:4000/)
-[] 2. Create an `Episode` type in your schema. Use the [documentation of the episode endpont](https://rickandmortyapi.com/documentation/#episode-schema) to define the shape of the `Episode` type. Here you are practicing what you've learned on the previous task (1).
-[] 2. Create an `Episode` type in your schema. Use the [documentation of the episode endpoint](https://rickandmortyapi.com/documentation/#episode-schema) to define the shape of the `Episode` type. Here you are practicing what you've learned on the previous task (1).
-[] 2.1. Add an `episodes` field to the Query type. The `episodes` field should return an array of [Episode]
-[] 2.1. Add an `episodes` field to the Query type. The `episodes` field should return an array of [Episode]
-[] 2.2. Add an `episodes` resolver to the Query's resolvers. You can return the mock episodes array which is in the scope and defined at the bottom of the file index.js.
-[] 2.2. Add an `episodes` resolver to the Query's resolvers. You can return the mock episodes array which is in the scope and defined at the bottom of the file index.js.
...
@@ -49,7 +49,7 @@ We are going to create our own GraphQL API on top of this [Rick and Morty API](h
...
@@ -49,7 +49,7 @@ We are going to create our own GraphQL API on top of this [Rick and Morty API](h
- Query characters
- Query characters
- Query episodes
- Query episodes
-[] 4. Create a relationship between Episode type and Character type in your schema. Please have a look at the [documentation of the episode endpont](https://rickandmortyapi.com/documentation/#episode-schema) to see how to get the episodes of a given character (heads up! we are calling the field in our Characters `episodes` but the REST API is calling the field that returns an array of episodes as `episode` - singular). Hints
-[] 4. Create a relationship between Episode type and Character type in your schema. Please have a look at the [documentation of the episode endpoint](https://rickandmortyapi.com/documentation/#episode-schema) to see how to get the episodes of a given character (heads up! we are calling the field in our Characters `episodes` but the REST API is calling the field that returns an array of episodes as `episode` - singular). Hints
- You need to add a `Character` key in the resolvers object and an object with an `episodes` key in `Character`. Similar to the Author type and books field in the [documentation](https://www.apollographql.com/docs/apollo-server/essentials/data#resolver-map). Hint: The first argument of the resolver is the 'parent' type, in this case, the parent of the `episodes` field is the `Character`. parent.episode gives you the array of episodes returned from the REST API.
- You need to add a `Character` key in the resolvers object and an object with an `episodes` key in `Character`. Similar to the Author type and books field in the [documentation](https://www.apollographql.com/docs/apollo-server/essentials/data#resolver-map). Hint: The first argument of the resolver is the 'parent' type, in this case, the parent of the `episodes` field is the `Character`. parent.episode gives you the array of episodes returned from the REST API.
- You can filter the episodes in our case using the `mapEpisodeUrlToEpisode` defined at the bottom of this file `src/index.js`.
- You can filter the episodes in our case using the `mapEpisodeUrlToEpisode` defined at the bottom of this file `src/index.js`.