cirro 0.1.0

Lightweight WebFramework combining server-side rendering and static caching using axum
Documentation
# cirro

A lightweight Rust library for building server-rendered websites with [Mustache](https://mustache.github.io/) templates, powered by [axum](https://github.com/tokio-rs/axum).

## Features

- Route builder API
- Mustache templating using [ramhorns]https://github.com/maciejhirsz/ramhorns
- In-memory page cache with TTL and tag-based invalidation
- Parameterised and catch-all route patterns (`{param}`, `{*catchall}`)

## Quick start

```rust
use cirro::{App, CacheConfig, Route};
use serde_json::json;
use std::time::Duration;

#[tokio::main]
async fn main() {
    let app = App::new()
        .template_dir("templates")
        .register(
            Route::new("/")
                .template("index.mustache")
                .cache(CacheConfig::new().ttl(Duration::from_secs(60)).tag("home"))
                .data(|_params| async { json!({ "title": "Home" }) }),
        )
        .register(
            Route::new("/blog/{slug}")
                .template("blog/post.mustache")
                .cache(CacheConfig::new().ttl(Duration::from_secs(300)).tag("blog"))
                .data(|params| async move {
                    let slug = params.get("slug").cloned().unwrap_or_default();
                    json!({ "title": format!("Post: {slug}"), "slug": slug })
                }),
        );

    app.serve("0.0.0.0:3000").await;
}
```

## Running the demo

```sh
cargo run --example demo
```