Created
June 6, 2016 13:35
-
-
Save ericstumper/97733fc56cc87d40dfda9e9aff60bb40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Languafy.Router do | |
use Languafy.Web, :router | |
pipeline :browser do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_flash | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers | |
end | |
pipeline :graphql do | |
plug Plug.Parsers, | |
parsers: [:urlencoded, :multipart, :json], | |
pass: ["*/*"], | |
json_decoder: Poison | |
plug Guardian.Plug.VerifyHeader, realm: "Bearer" | |
plug Guardian.Plug.LoadResource | |
end | |
if Mix.env == :dev do | |
get "/graphiql", Absinthe.Plug.GraphiQL, schema: Languafy.Schema | |
post "/graphiql", Absinthe.Plug.GraphiQL, schema: Languafy.Schema | |
end | |
scope "/graphql" do | |
pipe_through :graphql | |
forward "/", Absinthe.Plug, schema: Languafy.Schema | |
end | |
scope "/", Languafy do | |
pipe_through :browser # Use the default browser stack | |
get "*path", PageController, :index | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment