Moving On

In this chapter, we learned how to build the foundation of a GraphQL schema in an Elixir application, defining an object type that we exposed via a query field, and we tested our fledgling API using a popular tool, GraphiQL.

Here are a couple challenges for you before we move on:

  1. We’ve defined :id and :name fields for our MenuItem object type. The backing Ecto schema, PlateSlate.Menu.Item, has a number of other fields we could also expose in our GraphQL schema. Define another one using one of the built-in scalar types we mentioned earlier.
  2. Add descriptions for the fields inside the MenuItem object type, using the @desc form. Don’t stop there: you can use it to add a description for the object type itself, too. Verify that GraphiQL is displaying the descriptions.

Once you’re done, we’re going to look at supporting user input in the next chapter, which will open up a whole range of new and interesting API possibilities.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.212.71