1 | # elm-graphql
|
2 |
|
3 | `elm-graphql` generates [Elm](http://elm-lang.org) code for making [GraphQL](http://graphql.org) queries in a type-safe manner.
|
4 |
|
5 | At compile time, `elm-graphql` takes GraphQL schema and named queries in a
|
6 | .graphql file and generates corresponding Elm types. The schema is obtained by introspection
|
7 | of a live GraphQL server.
|
8 |
|
9 | `elm-graphql` is simply for making queries, it **is not** a framework like [Relay](https://facebook.github.io/relay/) but it could be the foundation other abstractions in the future.
|
10 |
|
11 | ## Install
|
12 |
|
13 | npm install -g elm-graphql
|
14 |
|
15 | ## Usage
|
16 |
|
17 | Configure the GraphQL endpoint URL. This will be saved in `elm-package.json`:
|
18 |
|
19 | elm graphql --init URL
|
20 |
|
21 | Now you can generate an Elm module for each .graphql file:
|
22 |
|
23 | elm graphql
|
24 |
|
25 | ## Example
|
26 |
|
27 | Check out my [elm-graphql-demo](https://github.com/jahewson/elm-graphql-demo) which provides a sample application and includes full build instructions.
|
28 |
|
29 | ## How it works
|
30 |
|
31 | See the wiki page, [how elm-graphql works](https://github.com/jahewson/elm-graphql/wiki/How-elm-graphql-works) for more details.
|
32 |
|
33 | ## Projects using elm-graphql
|
34 |
|
35 | - [elm-hipster-stack](https://github.com/carleryd/elm-hipster-stack): Elm, Phoenix, GraphQL and RethinkDB
|