51 lines
1.3 KiB
Markdown
51 lines
1.3 KiB
Markdown
# Calendar Server Example
|
||
|
||
A simple Rust web server using Hyper that exposes an `/all_calendars` endpoint.
|
||
|
||
## Running the server
|
||
|
||
```bash
|
||
# Navigate to the examples directory
|
||
cd /path/to/examples
|
||
|
||
# Build and run the server
|
||
cargo run
|
||
```
|
||
|
||
Once the server is running, you can access the endpoint at:
|
||
- http://127.0.0.1:8080/all_calendars
|
||
|
||
## Features
|
||
- Simple HTTP server using Hyper
|
||
- Single endpoint that returns "Hello World"
|
||
|
||
|
||
Sure thing! Here’s the Markdown version you can copy-paste directly into your README.md:
|
||
|
||
## 🔁 Live Reload (Hot Reload for Development)
|
||
|
||
To automatically recompile and restart your example server on file changes (e.g. Rust code, templates, Rhai scripts), you can use [`cargo-watch`](https://github.com/watchexec/cargo-watch):
|
||
|
||
### ✅ Step 1: Install `cargo-watch`
|
||
|
||
```bash
|
||
cargo install cargo-watch
|
||
```
|
||
|
||
### ✅ Step 2: Run the server with live reload
|
||
|
||
cargo watch -x 'run --example server'
|
||
|
||
This will:
|
||
• Watch for file changes in your project
|
||
• Rebuild and re-run examples/server.rs whenever you make a change
|
||
|
||
### 🧠 Bonus: Watch additional folders
|
||
|
||
To also reload when .tera templates or .rhai scripts change:
|
||
|
||
cargo watch -w src -w examples -w src/templates -w src/scripts -x 'run --example server'
|
||
|
||
### 💡 Optional: Clear terminal on each reload
|
||
|
||
cargo watch -c -x 'run --example server' |