RESTful Rust Todo service
Start Postgres DB
docker-compose --profile infra up -d
Run the SQL migration
diesel migration run
Run todoservice
cargo run --release
Run the tests
cargo test
Start Jaeger all-in-one docker container
docker-compose --profile tracing up -d
Open Jaeger UI on http://localhost:16686/
![jaeger](https://private-user-images.githubusercontent.com/27153243/284067676-283daa79-67e1-44bb-ab94-802b8aee7cb8.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMwNjUzODYsIm5iZiI6MTcyMzA2NTA4NiwicGF0aCI6Ii8yNzE1MzI0My8yODQwNjc2NzYtMjgzZGFhNzktNjdlMS00NGJiLWFiOTQtODAyYjhhZWU3Y2I4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA3VDIxMTEyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIyZmYxMTEyNTVmZDFhNmQyZGViNTY0ZmNlZGVjMmNkOTRjNzk5OTFmYWJlMDZiZmM3MTUxODI5MmM5Yzc2YzAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.rOTkDiJOJGP7l-ShztKQQ3HiKzh3S-zwFJlfZ9Fw8-8)
curl --location 'http://localhost:8080/todo' \
--header 'Content-Type: application/json' \
--data '{
"title":"title text",
"body":"body text"
}'
200 OK
{
"id": 1,
"title": "title text",
"body": "body text",
"completed": false
}
curl --location 'http://localhost:8080/todo/1'
200 OK
{
"id": 1,
"title": "title text",
"body": "body text",
"completed": false
}
curl --location --request DELETE 'http://localhost:8080/todo/1'
200 OK - (Empty response body)
curl --location 'http://localhost:8080/todo'
200 OK
[
{
"id": 1,
"title": "title text",
"body": "body text",
"completed": false
},
{
"id": 2,
"title": "a todo",
"body": "a todo",
"completed": true
},
{
"id": 3,
"title": "Clean out your car",
"body": "busywork",
"completed": true
}
]
curl --location --request POST 'http://localhost:8080/todo/random'
200 OK
{
"id": 3,
"title": "Clean out your car",
"body": "busywork",
"completed": false
}
curl --location --request PUT 'http://localhost:8080/todo/3'
200 OK
{
"id": 3,
"title": "Clean out your car",
"body": "busywork",
"completed": true
}
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this repo by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.