This is the code to training materials.
Technologies are as below:
- Rust programming language #rust_lang
- Actix web framework
- Postgres for database
- Diesel ORM
- REST API
- Install Rust follow link: https://www.rust-lang.org/tools/install
- Install Docker follow link: https://docs.docker.com/get-docker/
-
Install postgres in your device or inside docker image:
https://www.postgresql.org/download/
https://hub.docker.com/_/postgres -
install Diesel CLI, link: https://crates.io/crates/diesel_cli
cargo install diesel_cli --no-default-features --features "postgres"
After downloading this repo:
-
install database
diesel setup
-
run application
cargo run
Total APIs to be developed as below:
- register
- login
- user
- refresh
- logout
- forgot
- reset
- two-factor
- google-auth
-
Request:
GET http://127.0.0.1:8000/register
{ "first_name": "...", "last_name": "...", "email": "...", "password": "...", "confirm_password": "..." }
-
Response:
TODO
-
Request:
GET http://127.0.0.1:8000/login
{ "email": "...", "password": "..." }
-
Response:
{ "message": "User authenticated", "data": true }
Below are little resources:
https://serde.rs/derive.html
https://stackoverflow.com/questions/62269278/how-can-i-make-protected-routes-in-actix-web
https://actix.rs/docs/middleware/
https://actix.rs/
Thanks
Developed by Moaz bin Mohamed Mokhtar