mirror of
https://github.com/team-alembic/ash_authentication.git
synced 2024-09-20 21:33:10 +12:00
8797005175
* improvement(docs): change all references to `actor` to `user`. The word "actor" has special meaning in the Ash ecosystem. * chore: format `dev` directory also. * feat(Ash.PlugHelpers): Support standard actor configuration. * Adds the `:set_actor` plug which will set the actor to a resource based on the subject name. * Also includes GraphQL and JSON:API interfaces in the devserver for testing.
26 lines
486 B
Elixir
26 lines
486 B
Elixir
defmodule DevServer.GqlRouter do
|
|
@moduledoc """
|
|
Router for GraphQL requests.
|
|
"""
|
|
use Plug.Router
|
|
import Example.AuthPlug
|
|
|
|
plug(:load_from_bearer)
|
|
plug(:set_actor, :user_with_username)
|
|
plug(AshGraphql.Plug)
|
|
plug(:match)
|
|
plug(:dispatch)
|
|
|
|
forward("/playground",
|
|
to: Absinthe.Plug.GraphiQL,
|
|
init_opts: [
|
|
schema: Example.Schema,
|
|
interface: :playground
|
|
]
|
|
)
|
|
|
|
forward("/",
|
|
to: Absinthe.Plug,
|
|
init_opts: [schema: Example.Schema]
|
|
)
|
|
end
|