Running Our Query with GraphiQL

GraphiQL is “an in-browser IDE for exploring GraphQL,” and to make things easy for the user, Absinthe integrates with three versions of GraphiQL: the official interface,[10] an advanced version,[11] and GraphQL Playground.[12] All three are built in to the absinthe_plug[13] package and ready to go with just a little configuration.

The absinthe_plug dependency is already in our mix.exs file from the initial setup, but we need to now configure the Phoenix router to use it. Replace the existing "/" scope with the following block:

​ scope ​"​​/"​ ​do​
​  pipe_through ​:api​
​ 
​  forward ​"​​/api"​, Absinthe.Plug,
​  ​schema: ...

Get Craft GraphQL APIs in Elixir with Absinthe now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.