This project is a web server built with Rocket, using Diesel for database management and PostgreSQL as the database.
- REST API built with Rocket
- PostgreSQL integration via Diesel ORM
- CRUD operations for database entities
- Rust & Cargo (latest stable version)
- PostgreSQL installed and running
- Diesel CLI
- Windows (with workaround for Diesel issue) or Linux/MacOS
-
Install Rust:
Follow the instructions at Rust's official site.
-
Install PostgreSQL:
Download and install PostgreSQL from PostgreSQL's official site.
-
Install Diesel CLI:
Install the Diesel CLI with the following command:
cargo install diesel_cli --no-default-features --features postgres
-
Set Up PostgreSQL Database:
- Ensure PostgreSQL is running.
- Create a database.
createdb rocket_server
- Update your rocket.toml file with the database URL:
[global.databases] postgres_db = { url = "postgres://postgres:yourpassword@localhost/rocket_server" }
-
Setup Environment (Windows only workaround): If running on Windows, [follow this solution](diesel-rs/diesel#2947 (comment).
-
Run Migrations: Create the Diesel migrations:
diesel migration run
-
Run the Server: Run the Rocket server with:
$env:ROCKET_LOG="debug"; cargo run # for Windows ROCKET_LOG=debug cargo run # for Linux/MacOS
-
Access the server: The server will be available at
http://localhost:8000.
- If you're facing issues on Windows with Diesel, it’s a known problem. You may try running the project inside WSL or a Linux VM for better compatibility.
This project is licensed under the MIT license.