Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gribouille/elm-graphql
ELM library for GraphQL API
https://github.com/gribouille/elm-graphql
api elm graphql javascript
Last synced: 13 days ago
JSON representation
ELM library for GraphQL API
- Host: GitHub
- URL: https://github.com/gribouille/elm-graphql
- Owner: gribouille
- License: mpl-2.0
- Created: 2018-02-18T20:09:11.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-05-10T17:11:10.000Z (over 2 years ago)
- Last Synced: 2023-08-08T20:39:22.639Z (about 1 year ago)
- Topics: api, elm, graphql, javascript
- Language: Elm
- Homepage:
- Size: 67.4 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# elm-graphql
A simple ELM library to use the GraphQL API.
## Install
```
> elm install gribouille/elm-graphql
```## Examples
To run the examples:
```shell
$ cd examples
$ npm install
$ npm run server
$ npm run dev
```
Open [http://localhost:8000/src/Main.elm](http://localhost:8000/src/Main.elm).## Usage
GraphQL API:
```graphql
type User {
id: Int!
login: String!
firstname: String
lastname: String
email: String
}type Query {
users: [User!]!
...
}
```Library usage:
```elm
type alias User =
{ id : Int
, login : String
, firstname : String
, lastname : String
, email : String
}userDecoder : Decoder User
userDecoder = ...type Msg
= OnUsers (GraphQL.Response (List User))
| ...get : Cmd Msg
get =
GraphQL.run
{ query = "query { users { id login firstname lastname email } }"
, decoder = usersDecoder
, root = "users"
, url = ""
, headers = []
, on = OnUsers
, variables = Nothing
}
```## Documentation
The API documentation is available [here](http://package.elm-lang.org/packages/gribouille/elm-graphql/latest).
## Contributing
Feedback and contributions are very welcome.
## License
This project is licensed under [Mozilla Public License Version 2.0](./LICENSE).