A simple API built using Rust's Actix-web framework and Diesel ORM for interacting with Human
data.
The project demonstrates CRUD (Create, Read, Update, Delete) operations for a Human
entity. The operations include:
- Creating a new human.
- Reading all humans from the database.
- Updating an existing human's details.
- Deleting a human.
- Built with the Actix-web framework for asynchronous web handling.
- Uses Diesel ORM for database operations.
- SQLite as the database.
- Clean and clear route definitions.
- Structured error handling.
- Rust and Cargo installed.
- SQLite3
- Clone the repository:
git clone https://github.com/Goodnessuc/rusting-actix-diesel.git
- Navigate to the project directory:
cd rusting-actix-diesel
- Run migrations to setup the database:
diesel migration run
- Start the server:
cargo run
The server will start at 127.0.0.1:8080
.
- Method:
POST
- Endpoint:
/human
- Body:
{
"first_name": "John",
"last_name": "Doe",
"age": 30
}
- Method:
GET
- Endpoint:
/humans
- Method:
PUT
- Endpoint:
/human/{id}
- Body:
{
"first_name": "Jane",
"last_name": "Doe",
"age": 32
}
- Method:
DELETE
- Endpoint:
/human/{id}
Feel free to fork the project, make some updates, and submit pull requests.
This project is licensed under the MIT License.