2024-03-28 14:39:53 +13:00
|
|
|
# defmodule DevServer.GqlRouter do
|
|
|
|
# @moduledoc """
|
|
|
|
# Router for GraphQL requests.
|
|
|
|
# """
|
|
|
|
# use Plug.Router
|
|
|
|
# import Example.AuthPlug
|
2022-10-31 16:43:00 +13:00
|
|
|
|
2024-03-28 14:39:53 +13:00
|
|
|
# plug(:load_from_bearer)
|
|
|
|
# plug(:set_actor, :user)
|
|
|
|
# plug(AshGraphql.Plug)
|
|
|
|
# plug(:match)
|
|
|
|
# plug(:dispatch)
|
2022-10-31 16:43:00 +13:00
|
|
|
|
2024-03-28 14:39:53 +13:00
|
|
|
# forward("/playground",
|
|
|
|
# to: Absinthe.Plug.GraphiQL,
|
|
|
|
# init_opts: [
|
|
|
|
# schema: Example.Schema,
|
|
|
|
# interface: :playground
|
|
|
|
# ]
|
|
|
|
# )
|
2022-10-31 16:43:00 +13:00
|
|
|
|
2024-03-28 14:39:53 +13:00
|
|
|
# forward("/",
|
|
|
|
# to: Absinthe.Plug,
|
|
|
|
# init_opts: [schema: Example.Schema]
|
|
|
|
# )
|
|
|
|
# end
|