Guest User

Untitled

a guest
Feb 24th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. defmodule CoryWeb.Router do
  2. use CoryWeb, :router
  3.  
  4. defmodule SchemaOnePlug do
  5. def init(_), do: Absinthe.Plug.init(schema: CoryWeb.SchemaOne)
  6. def call(conn, opts), do: Absinthe.Plug.call(conn, opts)
  7. end
  8.  
  9. defmodule SchemaTwoPlug do
  10. def init(_), do: Absinthe.Plug.init(schema: CoryWeb.SchemaTwo)
  11. def call(conn, opts), do: Absinthe.Plug.call(conn, opts)
  12. end
  13.  
  14. pipeline :graphql do
  15. plug Plug.Parsers,
  16. parsers: [:urlencoded, :multipart, :json, Absinthe.Plug.Parser],
  17. json_decoder: Poison
  18. end
  19.  
  20. scope "/one", as: :one do
  21. pipe_through :graphql
  22. forward "/", SchemaOnePlug
  23. end
  24.  
  25. scope "/two", as: :two do
  26. pipe_through :graphql
  27. forward "/", SchemaTwoPlug
  28. end
  29.  
  30. end
Add Comment
Please, Sign In to add comment