Coder Social home page Coder Social logo

graphql-elixir's Introduction

GraphQL Elixir

Build Status Public Slack Discussion

An Elixir implementation of Facebook's GraphQL.

Installation

First, add GraphQL to your mix.exs dependencies:

defp deps do
  [{:graphql, "~> 0.0.2"}]
end

Then, update your dependencies:

$ mix deps.get

Usage

Parse a simple GraphQL query

iex> GraphQL.parse "{ hello }"
#=> [kind: :Document, loc: [start: 0],
#  definitions: [[kind: :OperationDefinition, loc: [start: 0], operation: :query,
#    selectionSet: [kind: :SelectionSet, loc: [start: 0],
#     selections: [[kind: :Field, loc: [start: 0], name: "hello"]]]]]]

Status

This is a work in progress, right now here's what is done:

  • Parser for GraphQL (including Type definitions)
  • AST matching the graphql-js types as closely as possible
  • Schema definition
  • Query execution
  • Introspection

Resources

Implementation

Tokenisation is done with leex and parsing with yecc. Both very useful Erlang tools for parsing. Yecc in particular is used by Elixir itself.

Some resources on using leex and yecc:

Developers

Getting Started

Clone the repo and fetch its dependencies:

$ git clone https://github.com/joshprice/graphql-elixir.git
$ cd graphql-elixir
$ mix deps.get
$ mix test

Atom Editor Support

Using the language-erlang package? .xrl and .yrl files not syntax highlighting?

Syntax highlighting in Atom for leex (.xrl) and yecc (yrl) can be added by modifying grammars/erlang.cson.

Just open the atom-language-erlang package code in Atom and make the change described here:

jonathanmarvens/atom-language-erlang#11

however if that PR has been merged then just grab the latest version of the plugin!

Contributing

We actively welcome pull requests, bug reports, feedback, issues, questions. Come and chat in the #erlang channel on Slack

License

BSD.

graphql-elixir's People

Contributors

1player avatar bruce avatar freshtonic avatar peburrows avatar

Watchers

 avatar  avatar  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.