From a54d29ee61ed831a1b4eb857b3cc664776ff26d3 Mon Sep 17 00:00:00 2001 From: Joao P Dubas Date: Thu, 24 Jun 2021 00:23:34 +0000 Subject: [PATCH] [day-03] configure router to expose graphql Expose graphql schema through absinthe plug. Also expose graphiql interface to make it easier to test graphql schema. --- lib/wabanex_web/router.ex | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/wabanex_web/router.ex b/lib/wabanex_web/router.ex index 4608f2b..8423cac 100644 --- a/lib/wabanex_web/router.ex +++ b/lib/wabanex_web/router.ex @@ -11,6 +11,13 @@ defmodule WabanexWeb.Router do get "/", IMCController, :index end + scope "/api" do + pipe_through :api + + forward "/graphql", Absinthe.Plug, schema: WabanexWeb.Schema + forward "/graphiql", Absinthe.Plug.GraphiQL, schema: WabanexWeb.Schema + end + # Enables LiveDashboard only for development # # If you want to use the LiveDashboard in production, you should put