This project is an Actix Web server for managing QR shirts. It includes a PostgreSQL database for storing shirt data.
Before you begin, ensure you have the following software installed on your local machine:
- Docker: Installation Guide
- Docker Compose: Installation Guide
- Rust and Cargo: Installation Guide
Clone this repository to your local machine:
git clone https://github.com/your-username/qr-shirts.git
cd qr-shirts
Create a .env
file in the root directory with the following content:
DATABASE_URL=postgres://user:password@localhost:5432/qr_shirts
Navigate to the docker directory and start the PostgreSQL database using Docker Compose:
cd docker
docker-compose up -d
This will start the PostgreSQL database in the background.
Navigate back to the root directory and run the server:
cargo run
This will start the Actix Web server. The server will be accessible at http://localhost:8080
.
You can access the PostgreSQL database using the psql command-line tool. First, get the container ID or name of the running PostgreSQL container:
docker ps
Then, use the following command to access the database:
docker exec -it <container_id> psql -U user -d qr_shirts
To stop the PostgreSQL database, run:
cd docker
docker-compose down