A simple web application using the Actix Web framework in Rust.
-
Make sure you have Rust and Cargo installed. You can install them from rustup.rs.
-
PostgreSQL should be installed (only its client
psqlis needed). You can download it from postgresql.org. -
Also, install the SQLx CLI tool with PostgreSQL support:
cargo install --version=0.8.6 sqlx-cli --no-default-features --features postgres
./scripts/init_db.sh
-
To skip Docker setup:
SKIP_DOCKER=true ./scripts/init_db.sh
cargo run
-
Set the
RUST_LOGenvironment variable to see detailed logs, default isinfo:RUST_LOG=trace cargo run -
Structured logs can be viewed in a more readable format using
bunyan:cargo run | bunyan -
Set the
APP_ENVIRONMENTenvironment variable toproductionto run in production mode, default islocal:APP_ENVIRONMENT=production cargo run
cargo test
-
Set
TEST_LOGenvironment variable to see logs during tests, and the default log level isdebugwhich also can be overridden byRUST_LOG:TEST_LOG=true RUST_LOG="sqlx=error,info" cargo test | bunyan
docker build --tag hello_actix_web:latest --file Dockerfile .
docker run -p 80xx:8000 hello_actix_web:latest