#mongo-db #graphql #boilerplate #starter #example

app graphql-mongodb-boilerplate

A simple Rust graphql service boilerplate using actix, mongodb and juniper

5 releases

0.3.1 May 2, 2020
0.3.0 Apr 26, 2020
0.1.2 Apr 24, 2020
0.1.1 Jan 19, 2020
0.1.0 Jan 19, 2020

#848 in HTTP server

MIT license

28KB
662 lines

Rust graphql service boilerplate

This provides a simple graphql boilerplate for services. It uses:

Just change/add to the models, services and the graphql_schema accorindgly.

Usage

Seed some data with...

cargo run --bin seed

Run the server with...

cargo run

And then test at:

http://localhost:8080/graphiql

Sample query for pets

{
  allPets(limit:4){
    pageInfo{
      startCursor
      nextCursor
      hasPreviousPage
      hasNextPage
    }
    pets{
      name
      id
      age
      petType
      gender
      owner{
        id
        username
      }
    }
    totalCount
  }
}

Sample query for owners

{
  allOwners {
    pageInfo {
      startCursor
      nextCursor
    }
    owners {
      id
      firstName
      lastName
      pets {
        id
        name
      }
    }
  }
}

Inspiration and some resources to help

Dependencies

~48MB
~1M SLoC