sangria-graphql/sangria-akka-http-example
Sobre
An example GraphQL server written with akka-http, circe and sangria
Aprendizado e educaçãoCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- 0
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalSangria akka-http Example
An example GraphQL server written with akka-http, circe and sangria.
After starting the server with
sbt run
# or, if you want to watch the source code changes
sbt ~reStart
you can run queries interactively using graphql-playground by opening http://localhost:8080 in a browser or query the /graphql endpoint directly. The HTTP endpoint follows GraphQL best practices for handling the HTTP requests.
Here are some examples of the queries you can make:
$ curl -X POST localhost:8080/graphql \
-H "Content-Type:application/json" \
-d '{"query": "{hero {name, friends {name}}}"}'
this gives back the hero of StarWars Saga together with the list of his friends, which is of course R2-D2:
{
"data": {
"hero": {
"name": "R2-D2",
"friends": [
{
"name": "Luke Skywalker"
},
{
"name": "Han Solo"
},
{
"name": "Leia Organa"
}
]
}
}
}
Here is another example, which uses variables:
$ curl -X POST localhost:8080/graphql \
-H "Content-Type:application/json" \
-d '{"query": "query Test($humanId: String!){human(id: $humanId) {name, homePlanet, friends {name}}}", "variables": {"humanId": "1000"}}'
The result should be something like this:
{
"data": {
"human": {
"name": "Luke Skywalker",
"homePlanet": "Tatooine",
"friends": [
{
"name": "Han Solo"
},
{
"name": "Leia Organa"
},
{
"name": "C-3PO"
},
{
"name": "R2-D2"
}
]
}
}
}
Explore projetos relacionados
Carregando…
