This repository is used to present how I find implementing DDD in Rust projects works out
- Clone the repository locally
https://github.com/behrouz-rfa/rust-ddd.git-
Execute the
bin/dotenvscript to create a.envfile or copy the contents of the.env.samplefile into a new file with the name.env -
Run the Docker
docker compose up -d- Install dependencies and execute the server
cargo run- For insert or registration
curl --location --request POST 'localhost:8082/api/users/insert' \
--header 'Content-Type: application/json' \
--data-raw '{
"username":"behrouz.r.fa",
"email":"behrouz.r.fa@gmail.com'\''",
"password":"pass@123"
}'
- for login
curl --location --request POST 'localhost:8082/api/users/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email":"behrouz.r.fa@gmail.com'\''",
"password":"pass@123"
}'
- update user
curl --location --request PUT 'localhost:8082/api/user' \
--header 'Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzMzMTY3OTUsImlkIjoyOCwidXNlcm5hbWUiOiJ0ZXN0MTEyMjIifQ._N82DPNiw27gVdBFuEPv2Tps_TbUH6wXgq-wBIxUQfc' \
--header 'Content-Type: application/json' \
--data-raw '{
"email":"master@gmail.com'\''",
"username":"master@123",
"bio": "this test for bio"
}'
- integration test
- fix db pool
- unit test
- Better error handling