Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sangria-graphql/sangria
Scala GraphQL implementation
https://github.com/sangria-graphql/sangria
api graphql sangria scala
Last synced: 10 days ago
JSON representation
Scala GraphQL implementation
- Host: GitHub
- URL: https://github.com/sangria-graphql/sangria
- Owner: sangria-graphql
- License: apache-2.0
- Created: 2015-07-05T21:29:30.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-05-10T02:34:33.000Z (6 months ago)
- Last Synced: 2024-05-21T04:17:21.829Z (6 months ago)
- Topics: api, graphql, sangria, scala
- Language: Scala
- Homepage: https://sangria-graphql.github.io
- Size: 7.5 MB
- Stars: 1,968
- Watchers: 62
- Forks: 221
- Open Issues: 64
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-graphql - Scala
- awesome-graphql - sangria - Scala GraphQL server implementation. (Libraries / Scala Libraries)
- awesome-github-repos - sangria-graphql/sangria - Scala GraphQL implementation (Scala)
- awesome-list - sangria - graphql | 1842 | (Scala)
- awesome-graphql - sangria - Scala GraphQL server implementation. (Libraries / Scala Libraries)
- awesome-scala - **sangria** - graphql/sangria) ![GitHub commit activity](https://img.shields.io/github/commit-activity/y/sangria-graphql/sangria) (Table of Contents / Database)
README
![Sangria Logo](https://sangria-graphql.github.io/assets/img/sangria-logo.svg)
[Sangria](https://sangria-graphql.github.io/) is a scala [GraphQL](http://facebook.github.io/graphql/) library.
![Continuous Integration](https://github.com/sangria-graphql/sangria/workflows/Continuous%20Integration/badge.svg)
[![Coverage Status](http://coveralls.io/repos/sangria-graphql/sangria/badge.svg?branch=master&service=github)](http://coveralls.io/github/sangria-graphql/sangria?branch=master)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.sangria-graphql/sangria_2.13/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.sangria-graphql/sangria_2.13)
[![License](http://img.shields.io/:license-Apache%202-brightgreen.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)
[![Scaladocs](https://www.javadoc.io/badge/org.sangria-graphql/sangria_2.13.svg?label=docs)](https://www.javadoc.io/doc/org.sangria-graphql/sangria_2.13)
[![Join the chat at https://gitter.im/sangria-graphql/sangria](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sangria-graphql/sangria?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)SBT Configuration:
```scala
libraryDependencies += "org.sangria-graphql" %% "sangria" % ""
```You can find an example application that uses akka-http with sangria here:
https://github.com/sangria-graphql/sangria-akka-http-example
More info and the documentation can be found in the project home page:
[https://sangria-graphql.github.io/](https://sangria-graphql.github.io/)
I would also recommend you to check out [Sangria Playground](https://github.com/sangria-graphql/sangria-playground).
It is an example of GraphQL server written with Play framework and Sangria. It also serves as a playground,
where you can interactively execute GraphQL queries and play with some examples.If you want to use sangria with [react-relay](https://facebook.github.io/relay) framework, then you also may be interested in [sangria-relay](https://github.com/sangria-graphql/sangria-relay).
Sangria is a spec compliant GraphQL implementation, so it works out of the box with [Apollo](https://github.com/apollographql/apollo-client), [Relay](https://facebook.github.io/relay/), [GraphiQL](https://github.com/graphql/graphiql) and other GraphQL tools and libraries.
## Hello World Example
In this example we will use [circe](https://github.com/circe/circe) JSON marshalling, so we also need to include following dependency:
```scala
libraryDependencies += "org.sangria-graphql" %% "sangria-circe" % "1.3.2"
```The most simple Hello World application might look like this:
```scala
import sangria.schema._
import sangria.execution._
import sangria.macros._
import sangria.marshalling.circe._
import scala.concurrent.ExecutionContext.Implicits.globalval QueryType = ObjectType("Query", fields[Unit, Unit](
Field("hello", StringType, resolve = _ => "Hello world!")
))val schema = Schema(QueryType)
val query = graphql"{ hello }"
val result = Executor.execute(schema, query)
result.foreach(res => println(res.spaces2))
```this example will print following result JSON:
```json
{
"data" : {
"hello" : "Hello world!"
}
}
```For more complex example, I would recommend you to check out the [Getting Started Tutorial](https://sangria-graphql.github.io/getting-started/).
## Issues, Bugs, Ideas
If you've got some interesting ideas to share or discovered a nasty bug, feel free to use
[Sangria's issue tracker](https://github.com/sangria-graphql/sangria/issues).
Also feel free to fork project and create the pull requests - they are highly appreciated!If you are facing an issue and not sure what would be the best way to describe it, the I would recommend you to use [this minimal gist](https://gist.github.com/OlegIlyenko/4068ad92e008cd4b5def1baa4ec3a67c) as a template.
## StackOverflow
In case you need some help or support, then you can use [StackOverflow](https://stackoverflow.com/questions/tagged/sangria) for this.
When you are [asking a question](https://stackoverflow.com/questions/ask?tags=scala,graphql,sangria),
be sure to add `scala`, `graphql` and `sangria` tags, so that other people can easily find them.## Gitter
For more general, lengthy discussions or pretty much anything else please join us in the
[gitter chat](https://gitter.im/sangria-graphql/sangria).## Contribute
If you like the project and would like to support it or contribute to it, then you are very welcome to do so.
You can spread the word and tweet about the project or even better - create a small blog post, video, example project and show how you use sangria and GraphQL.
I'm pretty sure it would be interesting for many people.Also you can contribute to [the documentation](https://github.com/sangria-graphql/sangria-website) or help others by answering questions on
[StackOverflow](https://stackoverflow.com/questions/tagged/sangria) or joining discussions on the [gitter chat](https://gitter.im/sangria-graphql/sangria).
It would be very helpful!Not to mention the code itself. There is nothing more exciting than hacking some stuff together :)
So please feel free to materialize your ideas in form of code and send pull requests!## License
**Sangria** is licensed under [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).