Absinthe Plug

CDN to China CDN

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-rc.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
[
<<<<<<< HEAD
...,
=======
{:absinthe_plug, "~> 1.2.3"},
>>>>>>> master
{: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`:
```elixir
forward "/graphiql",
Absinthe.Plug.GraphiQL,
schema: MyApp.Schema,

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

More Help

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

License

See LICENSE.