Make sure you have the rust installed using this command:
rustc --version
Make sure you have cargo installed using this command:
cargo --version
Make sure you have docker installed using this command:
docker --version
Make sure you have curl installed using this command:
curl --version
Build the code without running it
cargo build
Build the code and run all the tests
cargo test
Build the code and run all the tests
cargo run
Creating a docker image should be as simple as
docker build -t rustapp .
docker-compose up -d db
docker compose build
docker compose up rustapp
Request to get the all the users:
curl --location --request GET 'http://localhost:8080/users'
Example of a response:
[ { "id": 1, "name": "aaa", "email": "aaa@mail" }, { "id": 2, "name": "bbb", "email": "bbb@mail" } ]
Request to create a new user
curl --location --request POST 'http://localhost:8080/users' \
--header 'Content-Type: application/json' \
--data-raw '{"name": "aaa","email": "aaa@mail"}'
Request to get one specific user:
curl --location --request GET 'http://localhost:8080/users/2'
Example of a response:
{ "name": "new", "email": "new@mail" }
Request to update a user
curl --location --request PUT 'http://localhost:8080/users/2' \
--header 'Content-Type: application/json' \
--data-raw '{"name": "new","email": "new@mail"}'
Request to delete a user
curl --location --request DELETE 'http://localhost:8080/users/3'
This project is maintained by MikAoJk