This is a simple todo API built with Rust and Actix-Web. It uses MySQL database to store the todos.
-
Authentication
- Register
- Login
- Refresh token
- Logout
- (The API uses JWT for authentication.)
-
Todos: CRUD operations
- Includes pagination and sorting
-
User: CRUD operations
-
Coming soon: User roles and permissions
Before you begin, ensure you have met the following requirements:
To install , follow these steps:
- Clone the repository:
git clone https://github.com/chornthorn/rust-todo-app.git
- Navigate to the project directory:
cd rust-todo-app
Before running the application, you need to set up the database. This project uses sqlx
, which supports multiple database systems. The instructions below are for MySQL.
-
Install MySQL if you haven't already. You can download it from here.
-
Create a new MySQL database for the project.
-
Copy the
.env.example
file to a new file named.env
:
cp .env.example .env
- Open the
.env
file and set theDATABASE_URL
environment variable to the connection string for your database. For example, it might look like this:
DATABASE_URL=mysql://username:password@localhost/database_name
Replace username
, password
, and database_name
with your actual MySQL username, password, and the name of the database you created.
This project uses sqlx
for database migrations. To run migrations, follow these steps:
- Install the
sqlx-cli
tool if you haven't already:
brew install sqlx-cli
- Run the migrations:
sqlx migrate run
or using cargo:
cargo sqlx migrate run
This will apply all migrations in the migrations
directory to your database.
To use , follow these steps:
- Build the project:
cargo build --release
- Run the project:
cargo run
To run tests, use the following command:
cargo test
To contribute to Rust Todo API with Actix-Web, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request.
If you want to contact me you can reach me at thorn.c@khodedev.com
.
This project uses the following license: MIT.