GraphQL backend for an imaginary chocolate shop implemented in Rust, rocket
, async-graphql
and sqlx
. For detailed installation guide please refer to the bootstrap project. The only difference is that I used SQLx CLI instead of golang tool mentioned there.
GraphQL schema is quite simple:
enum ChocolateType {
Bitter, White, Milk
}
type Product {
id: Int!
name: String!
description: String!
price: Int!
chocolateType: ChocolateType!
fillings: [String]
images: [String]!
}
Requests include querying, updating a price of a product and deleting it.
To facilitate the migrations flow I recommend using the SQLx CLI. It allows you to add and run migrations in a clean fashion. Please refer to migrations folder to see some examples.
The current configuration in Rocket.toml
has been setup to run the micro-service on port 7600. After you have cargo build
and cargo run
, you can play with the GraphQL at localhost:7600