mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-20 05:13:33 +12:00
docs: add AshGraphql.Plug
to getting started guide
This commit is contained in:
parent
b8b5b61786
commit
4ad72e0ee1
1 changed files with 8 additions and 0 deletions
|
@ -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",
|
||||||
|
|
Loading…
Reference in a new issue