This is a simple CRUD API for managing users using Actix Web and MongoDB.
- Rust installed
- MongoDB running
- Docker (optional, for containerization)
Create a .env file with:
MONGO_URI=mongodb://localhost:27017
DATABASE_NAME=my_database
Then, run:
cargo runBuild and run the container:
docker build -t rust-app .
docker run -p 5050:3030 rust-appGET/users
curl --location 'http://localhost:5050/users'POST/users
curl --location 'http://localhost:5050/users' \
--header 'Content-Type: application/json' \
--data-raw '{ "name": "John Doe", "email": "john@example.com", "age": 30}'PUT/users/{user-id}
curl --location --request PUT 'http://localhost:5050/users/<user-id>' \
--header 'Content-Type: application/json' \
--data-raw '{ "name": "John Doe", "email": "john.doe@example.com", "age": 37}'DELETE/users/{user-id}
curl --location --request DELETE 'http://localhost:5050/users/<user-id>'