A robust CRUD application built with Rust, featuring user authentication, question-answer functionality, and containerized deployment.
Before you begin, ensure you have installed:
- Rust (1.75 or later)
- Docker (20.10 or later)
- Docker Compose (v2.0 or later)
- PostgreSQL (15 or later, if running locally)
-
Clone the repository:
git clone https://github.com/bjergsen243/rust_hour cd rust_hour -
Copy the environment file and configure it:
cp .env.example .env # Edit .env with your configuration -
Start the application using Docker:
docker compose up -d
The API will be available at
http://localhost:8080
-
Install Rust dependencies:
cargo build
-
Run the tests:
cargo test -
Start the development server:
cargo run
| Endpoint | Description |
|---|---|
POST /registration |
Create a new user account |
POST /login |
Authenticate a user and obtain a JWT token |
PUT /accounts |
Update user email |
PUT /accounts/update_password |
Update user password |
GET /accounts/me |
Retrieve information about the authenticated user |
POST /questions |
Create a new question |
PUT /questions/{id} |
Update an existing question |
DELETE /questions/{id} |
Delete a question |
GET /questions |
List questions with optional pagination |
GET /questions/{id}/answers |
Get answers for a specific question |
POST /answers |
Create a new answer |
PUT /answers/{id} |
Update an existing answer |
DELETE /answers/{id} |
Delete an answer |