Giter Club home page Giter Club logo

absinthe_phoenix's Introduction

Absinthe.Phoenix

Build Status Version Hex Docs Download License Last Updated

This package integrates Absinthe subscriptions with Phoenix, so that you can use subscriptions via websockets.

For getting started guides on subscriptions see: https://hexdocs.pm/absinthe/subscriptions.html

For getting started guides on server side rendering see: https://hexdocs.pm/absinthe/subscriptions.html

Installation

Install from Hex.pm:

For Phoenix 1.4, see the v1.5 branch: https://github.com/absinthe-graphql/absinthe_phoenix/tree/v1.5

Phoenix 1.5

def deps do
  [
    {:absinthe_phoenix, "~> 2.0.0"}
  ]
end

Note: Absinthe.Phoenix requires Elixir 1.10 or higher.

Upgrading

See CHANGELOG for upgrade steps between versions.

You may want to look for the specific upgrade guide in the Absinthe documentation.

Documentation

See "Usage," below, for basic usage information and links to specific resources.

Related Projects

See the GitHub organization.

Usage

You need to have a working Phoenix PubSub configured. Here is what the default looks like if you create a new Phoenix project:

config :my_app, MyAppWeb.Endpoint,
  # ... other config
  pubsub_server: MyApp.PubSub

In your application supervisor add a line AFTER your existing endpoint supervision line:

[
  # other children ...
  MyAppWeb.Endpoint, # this line should already exist
  {Absinthe.Subscription, MyAppWeb.Endpoint}, # add this line
  # other children ...
]

Where MyAppWeb.Endpoint is the name of your application's phoenix endpoint.

In your MyAppWeb.Endpoint module add:

use Absinthe.Phoenix.Endpoint

In your socket add:

use Absinthe.Phoenix.Socket,
  schema: MyAppWeb.Schema

Where MyAppWeb.Schema is the name of your Absinthe schema module.

That is all that's required for setup on the server.

For client side guidance see the guides.

GraphiQL Usage

From within GraphiQL: To use Absinthe.Phoenix from within GraphiQL, you need to tell GraphiQL about your websocket endpoint.

forward "/graphiql", Absinthe.Plug.GraphiQL,
  schema: MyAppWeb.Schema,
  socket: MyAppWeb.UserSocket

Community

The project is under constant improvement by a growing list of contributors, and your feedback is important. Please join us in Slack (#absinthe-graphql under the Elixir Slack account) or the Elixir Forum (tagged absinthe).

Please remember that all interactions in our official spaces follow our Code of Conduct.

Contributing

Please follow contribution guide.

Copyright and License

Copyright (c) 2016 Bruce Williams, Ben Wilson

Released under the MIT License, which can be found in LICENSE.md.

absinthe_phoenix's People

Contributors

benwilson512 avatar bruce avatar scrogson avatar thiamsantos avatar jlgeering avatar dolfinus avatar adri avatar xtian avatar seeekr avatar devonestes avatar xfumihiro avatar g3z avatar jerel avatar kianmeng avatar maartenvanvliet avatar woylie avatar bleushan avatar tcitworld avatar tmw avatar telnicky avatar azhi avatar marocchino avatar technicalcapt avatar vic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.