- Clean Architect
- Independent framework: I've tried actix-web, warp, ...
- Independent database: Support MySQL, PostgresSQL ...
export DATABASE_URL='dev.db'
cargo install diesel_cli --no-default-features --features "postgres sqlite mysql"
diesel setup
diesel migration run
# Insert sample users
cargo run --bin insert_users
Run the server
Check the server's running
curl http://127.0.0.1:8000/
curl http://127.0.0.1:8000/health
Login
# required jq installed.
export TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"email": "hienduyph@gmail.com", "password": "admin"}' http://127.0.0.1:8000/auth/login | jq -r '.token')
Users
curl -s -H "Authorization: bearer $TOKEN" http://127.0.0.1:8000/users
curl -s -H "Authorization: bearer $TOKEN" http://127.0.0.1:8000/users/1802d2f8-1a18-43c1-9c58-1c3f7100c842