From 42970c4c5c4703d725c609aedc4799e81833f043 Mon Sep 17 00:00:00 2001 From: an920107 Date: Sun, 18 May 2025 18:30:08 +0800 Subject: [PATCH] BLOG-43 docs: readme document for backend start --- backend/README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 backend/README.md diff --git a/backend/README.md b/backend/README.md new file mode 100644 index 0000000..89d98eb --- /dev/null +++ b/backend/README.md @@ -0,0 +1,42 @@ +# Backend + +## Development + +### SQL Migration + +1. Install sqlx + + ```bash + cargo install sqlx-cli + ``` + +2. Run migration + + ```bash + sqlx migrate run + ``` + +### Run Project + +1. Prepare for sql schema setup + + ```bash + cargo sqlx prepare --workspace + ``` + +2. Run the server + + ```bash + RUST_LOG=debug cargo run + ``` + +3. (Optional) Hot restart + + 1. Install `watchexec` + + 2. Run the server with `watchexec` + + ```bash + RUST_LOG=debug watchexec -e rs -r 'cargo run' + ``` +