Directory Structure
A rusty-gql project has the following directory structure.
rusty-gql-project
┣ schema
┃ ┗ schema.graphql
┣ src
┃ ┣ graphql
┃ ┃ ┣ directive
┃ ┃ ┃ ┗ mod.rs
┃ ┃ ┣ input
┃ ┃ ┃ ┗ mod.rs
┃ ┃ ┣ mutation
┃ ┃ ┃ ┗ mod.rs
┃ ┃ ┣ query
┃ ┃ ┃ ┣ mod.rs
┃ ┃ ┣ resolver
┃ ┃ ┃ ┣ mod.rs
┃ ┃ ┣ scalar
┃ ┃ ┃ ┗ mod.rs
┃ ┃ ┗ mod.rs
┃ ┗ main.rs
┗ Cargo.toml
schema
GraphQL schema files are located under schema/**
.
We can also place multiple GraphQL files.
For example, like this.
schema
┣ post
┃ ┗ post.graphql
┣ user
┃ ┗ user.graphql
┗ index.graphql
src/graphql/query
Query resolvers.
src/graphql/mutation
Mutation resolvers.
src/graphql/resolver
GraphQL Object
, Enum
, Union
, Interface
types.
src/graphql/input
GraphQL InputObject.
src/graphql/scalar
Custom scalars.
src/graphql/directive
Custom directives.