A learning repository for Rust programming language featuring practical examples and projects.
lets_get_rusty/
├── README.md
└── basic-rust-api/
├── Cargo.toml
└── src/
└── main.rs
A simple REST API built with Rust and Actix-web demonstrating basic CRUD operations for managing books.
- RESTful endpoints for managing books
- In-memory storage using Mutex for thread-safe data access
- JSON request/response handling
- Basic error handling
- Concurrent request processing
- Navigate to the API directory:
cd basic-rust-api- Build the project:
cargo build- Run the server:
cargo runThe server will start on http://127.0.0.1:8080
| Method | Endpoint | Description |
|---|---|---|
| GET | /books | Get all books |
| GET | /books/{id} | Get a book by ID |
| POST | /books | Create a new book |
| DELETE | /books/{id} | Delete a book by ID |
Create a Book:
curl -X POST -H "Content-Type: application/json" -d '{"id": 1, "title": "Rust Programming", "author": "John Doe"}' http://localhost:8080/booksGet All Books:
curl http://localhost:8080/booksGet a Specific Book:
curl http://localhost:8080/books/1Delete a Book:
curl -X DELETE http://localhost:8080/books/1- Rust (latest stable version)
- Cargo (comes with Rust)
Clone the repository:
git clone https://github.com/Ismat-Samadov/lets_get_rusty.git
cd lets_get_rusty- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request