Skip to content

scrogson/absinthe_plug

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Absinthe Plug

Build Status

Plug support for Absinthe, the GraphQL toolkit for Elixir.

Please see the website at http://absinthe-graphql.org.

Installation

Install from Hex.pm:

def deps do
  [{:absinthe_plug, "~> 1.3.0"}]
end

If using Elixir < 1.4 (or manually managing applications), make sure to add it to your applications configuration in mix.exs:

def application do
  [applications: [:absinthe_plug]]
end

Absinthe.Plug also requires a JSON codec. Poison works out of the box.

def deps do
  [
    ...,
    {:absinthe_plug, "~> 1.3.0"},
    {:poison, "~> 1.3.0"}
  ]
end

Usage

Basic Usage:

plug Plug.Parsers,
  parsers: [:urlencoded, :multipart, :json, Absinthe.Plug.Parser],
  pass: ["*/*"],
  json_decoder: Poison

plug Absinthe.Plug,
  schema: MyApp.Schema

If you want only Absinthe.Plug to serve a particular route, configure your router like:

plug Plug.Parsers,
  parsers: [:urlencoded, :multipart, :json, Absinthe.Plug.Parser],
  pass: ["*/*"],
  json_decoder: Poison

forward "/api", Absinthe.Plug,
  schema: MyApp.Schema

For more information, see the API documentation for Absinthe.Plug.

GraphiQL

To add support for a GraphiQL interface, add a configuration for Absinthe.Plug.GraphiQL:

forward "/graphiql",
  Absinthe.Plug.GraphiQL,
  schema: MyApp.Schema,

See the API documentation for Absinthe.Plug.GraphiQL for more information.

More Help

Related Projects

See the project list at http://absinthe-graphql.org/projects.

License

See LICENSE.

About

Plug support for Absinthe, the GraphQL toolkit for Elixir

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Elixir 93.6%
  • HTML 6.4%