vyuh 0.2.2

Vyuh web framework for Axum and SQLx with handler-first APIs
Documentation
//! Basic project template directory configuration.
//!
//! Run:
//!
//! ```sh
//! cargo run --example templates_basic
//! ```

use vyuh::{
    SiteConf, bundles,
    routes::Html,
    templates::{TemplateError, Templates},
};

#[bundles::route(path = "/hello")]
async fn hello(templates: Templates) -> Result<Html<String>, TemplateError> {
    templates.html("hello.html", &serde_json::json!({ "name": "Vyuh" }))
}

fn main() {
    let conf = SiteConf::default().templates_dir("templates");
    let bundle = bundles::bundle! {
        hello,
    };

    assert_eq!(conf.templates.dirs, vec!["templates"]);
    assert!(bundle.reverse("hello", &[]).is_some());
    println!("configured project templates from ./templates");
}