A simple TODO list API built with Rust and Actix-web.
Note: This version is updated for Rust 1.87. The original code can be found in the
original-code
branch.
-
Setup environment
cp .env.example .env
-
Start database
docker-compose up -d postgres
-
Install dependencies
cargo install diesel_cli --no-default-features --features postgres
-
Setup database
DATABASE_URL=postgres://actix:actix@localhost:5432/actix diesel migration run
-
Run the server
cargo run
The API will be available at http://localhost:8080
Method | Endpoint | Description |
---|---|---|
GET |
/ |
Health check |
GET |
/todos |
List all todo lists |
GET |
/todos/{id} |
Get a specific todo list |
POST |
/todos |
Create a new todo list |
GET |
/todos/{id}/items |
Get items in a todo list |
GET |
/todos/{id}/items/{item_id} |
Get a specific item |
POST |
/todos/{id}/items |
Add item to a todo list |
PUT |
/todos/{id}/items/{item_id} |
Toggle item completion |
# Run tests
cargo test
# Run integration tests
cargo test --features "integration"
- Rust
- Docker & docker-compose
- PostgreSQL