This is an example of using Prisma Client Rust with Rocket.
Generate the client:
cargo prisma generate
Then run the server:
cargo run
Server is configured using Rocket.toml
or environment variables.
By default, this server is configured for http://localhost:8080.
Read about Rocket configuration here.
Written by Aaron Leopold
http://localhost:8080/api/users
[
{
"id": "5ab80953-c38c-4ec8-8b4b-3ecc4bc1196f",
"displayName": "oromei",
"posts": [
{
"id": "f001144f-438f-4fdb-9ed7-23f2cc5fffa7",
"content": "Woah there!",
"user": null,
"userId": "5ab80953-c38c-4ec8-8b4b-3ecc4bc1196f"
}
]
}
]
http://localhost:8080/api/users?load_posts=false
[
{
"id": "5ab80953-c38c-4ec8-8b4b-3ecc4bc1196f",
"displayName": "oromei",
"posts": null
}
]
http://localhost:8080/api/posts
[
{
"id": "f001144f-438f-4fdb-9ed7-23f2cc5fffa7",
"content": "Woah there!",
"user": null,
"userId": "5ab80953-c38c-4ec8-8b4b-3ecc4bc1196f"
}
]