1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00
examples/juniper
2019-12-20 22:30:26 +06:00
..
src fix juniper example 2019-12-08 00:03:53 +06:00
Cargo.toml update dependencies 2019-12-20 22:30:26 +06:00
README.md Update Juniper example (#197) 2019-12-07 23:59:35 +06:00

Juniper

Juniper integration for Actix web

Usage

server

cd examples/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"
    }
  }
}