mirror of
https://github.com/actix/examples
synced 2024-12-05 03:01:55 +01:00
1.1 KiB
1.1 KiB
Juniper
Juniper integration for Actix Web. If you want more advanced example, see also the juniper-advanced example.
Usage
server
cd graphql/juniper
cargo run (or ``cargo watch -x run``)
# Started http server: 127.0.0.1:8080
web client
http://127.0.0.1:8080/graphiql
Query example:
{
human(id: "1234") {
name
appearsIn
homePlanet
}
}
Result:
{
"data": {
"human": {
"name": "Luke",
"appearsIn": [
"NEW_HOPE"
],
"homePlanet": "Mars"
}
}
}
Mutation example:
mutation {
createHuman(newHuman: {name: "Fresh Kid Ice", appearsIn: EMPIRE, homePlanet: "earth"}) {
id
name
appearsIn
homePlanet
}
}
Result:
{
"data": {
"createHuman": {
"id": "1234",
"name": "Fresh Kid Ice",
"appearsIn": [
"EMPIRE"
],
"homePlanet": "earth"
}
}
}