docs: add AshGraphql.Plug to getting started guide

This commit is contained in:
Zach Daniel 2023-03-20 01:00:58 -04:00
parent b8b5b61786
commit 4ad72e0ee1

View file

@ -117,6 +117,8 @@ adding plug to your application.
Then you can use a `Plug.Router` and [forward](https://hexdocs.pm/plug/Plug.Router.html#forward/2) to your plugs similar to how it is done for phoenix: Then you can use a `Plug.Router` and [forward](https://hexdocs.pm/plug/Plug.Router.html#forward/2) to your plugs similar to how it is done for phoenix:
```elixir ```elixir
plug AshGraphql.Plug
forward "/gql", forward "/gql",
to: Absinthe.Plug, to: Absinthe.Plug,
init_opts: [schema: Helpdesk.Schema] init_opts: [schema: Helpdesk.Schema]
@ -136,7 +138,13 @@ You will simply want to add some code to your router, like so.
You will also likely want to set up the "playground" for trying things out. You will also likely want to set up the "playground" for trying things out.
```elixir ```elixir
pipeline :graphql do
plug AshGraphql.Plug
end
scope "/" do scope "/" do
pipe_through [:graphql]
forward "/gql", Absinthe.Plug, schema: Helpdesk.Schema forward "/gql", Absinthe.Plug, schema: Helpdesk.Schema
forward "/playground", forward "/playground",