close
Skip to content

yashksaini-coder/Todo-rust-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Todo Server

A simple REST API todo server built with Rust and Actix Web.

Features

  • Create, read, update, and delete todos
  • In-memory storage (data is lost when server restarts)
  • JSON API responses
  • Health check endpoint

Project Structure

  • src/main.rs - Main application entry point, server setup, and data structures
  • src/routes.rs - HTTP route handlers for all API endpoints

Running the Server

  1. Make sure you have Rust installed
  2. Clone this repository
  3. Run the server:
cargo run

The server will start on http://localhost:8080

API Endpoints

Health Check

  • GET / - Returns server status

Todo Operations

  • GET /api/todos - Get all todos
  • POST /api/todos - Create a new todo
  • GET /api/todos/{id} - Get a specific todo by ID
  • PUT /api/todos/{id} - Update a todo
  • DELETE /api/todos/{id} - Delete a todo

Example Usage

Create a todo

curl -X POST http://localhost:8080/api/todos \
  -H "Content-Type: application/json" \
  -d '{"title": "Learn Rust"}'

Get all todos

curl http://localhost:8080/api/todos

Update a todo

curl -X PUT http://localhost:8080/api/todos/{id} \
  -H "Content-Type: application/json" \
  -d '{"title": "Learn Rust Advanced", "completed": true}'

Delete a todo

curl -X DELETE http://localhost:8080/api/todos/{id}

Dependencies

  • actix-web - Web framework
  • tokio - Async runtime
  • serde - Serialization/deserialization
  • serde_json - JSON support
  • uuid - UUID generation
  • env_logger - Logging

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages