Skip to content

Example using Rust Actix-web with juniper and diesel, connecting to postgreSQL (r2d2 - pooled connection)

Notifications You must be signed in to change notification settings

fattenap/actix-web-juniper-diesel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example

Example using Rust Actix-web with juniper and diesel, connecting to postgreSQL (r2d2 - pooled connection)

Running the example

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

Open Graphql client

http://localhost:8080/graphiql

Create a User

mutation User($newUser: NewUser!) {
  createUser(newUser: $newUser) {
    id
    name
  }
}

query variables

{
  "newUser": {
    "id": "123",
    "name": "Bob"
  }
}

Get a User

query User($id: String!) {
  user(id: $id) {
    id
    name
  }
}

query variables

{
  "id": "123"
}

About

Example using Rust Actix-web with juniper and diesel, connecting to postgreSQL (r2d2 - pooled connection)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published