Make sure you have the rust installed using this command:
rustc --versionMake sure you have cargo installed using this command:
cargo --versionMake sure you have docker installed using this command:
docker --versionMake sure you have docker compose installed using this command:
docker compose --versionMake sure you have curl installed using this command:
curl --versionBuild the code without running it
cargo buildBuild the code and run all the tests
cargo testBuild the code and run all the tests
Note This will not work, you need a database to run the application locally se Run the applicaiton with dockercompose
cargo runCreating a docker image should be as simple as
docker build -t rustapp .docker compose up docker compose up dbRequest 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