Skip to content

ayush80942/Task-Tracker-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦀 Task Tracker API (Rust + Axum)

A simple and modular Task Tracker API built using Rust and Axum. This project demonstrates how to create a RESTful API with in-memory state management and support for basic CRUD operations.


🚀 Features

  • ✅ Health Check (GET /health)
  • 📄 Get All Tasks (GET /tasks)
  • 🔍 Get Task by ID (GET /tasks/:id)
  • 🆕 Create Task (POST /tasks)
  • 📝 Update Task (PUT /tasks/:id)
  • ❌ Delete Task (DELETE /tasks/:id)
  • 🔄 Toggle Completion Status (PATCH /tasks/:id/toggle)

🧩 Tech Stack

  • Language: Rust
  • Framework: Axum
  • State Management: Arc<Mutex<Vec<Task>>>
  • UUID Support: uuid crate
  • Serialization: serde

🛠️ Setup

1. Clone the repo

git clone https://github.com/yourusername/task_tracker_api.git
cd task_tracker_api

2. Install dependencies

Make sure you have Rust installed: https://rustup.rs

Then run:

cargo build

3. Run the server

cargo run

Visit: http://localhost:3000


📬 API Endpoints

Health Check

GET /health

Get All Tasks

GET /tasks

Get Task by ID

GET /tasks/{id}

Create New Task

POST /tasks
Content-Type: application/json

{
  "title": "Learn Axum"
}

Update Task

PUT /tasks/{id}
Content-Type: application/json

{
  "id": "UUID_HERE",
  "title": "Updated Title",
  "completed": true
}

Delete Task

DELETE /tasks/{id}

Toggle Task Completion

PATCH /tasks/{id}/toggle

🧠 Project Structure

src/
├── main.rs        # App entrypoint & router setup
├── handlers.rs    # Route handler logic
├── models.rs      # Task structs & types
└── state.rs       # Shared application state

About

Designed a modular Task Tracker API using Rust and Axum with RESTful endpoints and in-memory state.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages