|Oct 30, 2023
#115 in HTTP server
38 downloads per month
Web Service Tutorial in Rust
This project serves as a comprehensive tutorial for building a web service using the Rust programming language. It covers various aspects, from setting up a PostgreSQL database to handling JSON responses.
- Rust: The core programming language used for this project.
- Tokio: An asynchronous runtime for Rust.
- SQLx: A Rust library for connecting to PostgreSQL databases.
- Dotenv: A Rust crate for handling
- Serde: A Rust crate for serializing and deserializing data structures.
- Actix-Web: A Rust framework for building web services.
- Chrono: A time manipulation library for Rust.
To generate documentation for this project:
cargo doc --open
Alternatively, you can find documentation for each crate on docs.rs.
- Ensure you have Docker Compose installed. If not, you can download it from Docker Desktop.
Environment Variables: Copy the sample environment file and configure the variables.
cp env.example .env
Docker Compose: Start the Docker containers.
docker compose up -d
Test Routes: Open your browser or use a tool like Postman to hit the following route:
Database GUI (PgAdmin4)
- Access the PgAdmin4 interface at
For detailed instructions on adding a PostgreSQL server in PgAdmin4, refer to the PG Admin guide.
init.sql file contains the SQL statements that define the database schema. Feel free to explore it to understand the database structure.
SKIP_AUTH environment variable controls JWT authentication. Set it to
true to disable JWT during development.