Example using Rust Actix-web with juniper and diesel, connecting to postgreSQL (r2d2 - pooled connection)
If you haven't already, install diesel_cli.
cargo install diesel_cli --no-default-features --features postgres
Ensure that you have a postgreSQL server running and from the project root directory run.
echo "DATABASE_URL=[databaseUrl]" > .env
diesel migration run
cargo run
N.b. - Replace [databaseUrl]
with your database url
http://localhost:8080/graphiql
mutation User($newUser: NewUser!) {
createUser(newUser: $newUser) {
id
name
}
}
query variables
{
"newUser": {
"id": "123",
"name": "Bob"
}
}
query User($id: String!) {
user(id: $id) {
id
name
}
}
query variables
{
"id": "123"
}