1
0
mirror of https://github.com/actix/examples synced 2024-11-27 16:02:57 +01:00
examples/juniper
2020-06-17 23:33:01 +01:00
..
src Fix function name that camel to snake (#332) 2020-06-17 23:33:01 +01:00
Cargo.toml Update juniper example (#233) 2020-01-13 01:14:08 +09:00
README.md Rename graphql-demo to juniper-advanced 2020-05-19 14:23:28 +09:00

Juniper

Juniper integration for Actix web. If you want more advanced example, see also the juniper-advanced example.

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"
    }
  }
}